0.0.5 • Published 4 years ago

kath v0.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

kath

Another in-memory caching

Under Construction.

Installation

$ yarn add kath

Usage

const { createCache } = require('kath');

const cache = createCache(10);

cache.put('key', 'value');

console.log(cache.get('key'));

// key

API

createCache(capacity: number, cache?: Map<any, Entry>): LRUCache

  • capacity - The capacity of the cache.
  • cache - Create with a existing cache.

LRUCache

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;
}

toCacheMap(cacheStr: string): Map<any, Entry>

Parse JSON string to Map<string, Entry>.

toJSON(cacheMap: Map<any, Entry>): string

Stringify cache map to JSON string.

License

MIT

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago