ladda-js / ladda

JavaScript data fetching layer with caching
https://petercrona.gitbooks.io/ladda/content/
MIT License
112 stars 16 forks source link

insufficient documentation #31

Open daxim opened 7 years ago

daxim commented 7 years ago

I have worked with about a dozen of different caches, but with the documentation at hand, I can't figure out even the most basic task, storing and retrieving data with a simple key. Hypothetical, to give you an idea:

import Cache from 'ladda-cache';
import sleep from 'es7-sleep';
const c = new Cache;
c.set({
    key: 'KEY',
    value: 'VALUE',
    expires: Date.now() + 2000
});
console.log(c.get({key: 'KEY'})); // 'VALUE'
await sleep(2000);
console.log(c.get({key: 'KEY'})); // null

What does the real code need to look like?

Further questions, didn't find anything useful when grepping for keywords: