Another in-memory caching
Under Construction.
$ yarn add kath
const { createCache } = require('kath');
const cache = createCache(10);
cache.put('key', 'value');
console.log(cache.get('key'));
// key
capacity
- The capacity of the cache.cache
- Create with a existing cache.
class LRUCache extends DDL {
private _capacity;
private _cache;
constructor(capacity: number, cache?: Map<any, Entry>);
get(key: any): any;
put(key: any, value: any): void;
data(): Map<any, Entry>;
private moveToHead;
}
Parse JSON string to Map<string, Entry>
.
Stringify cache map to JSON string.