kath
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

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

/kath/

    Package Sidebar

    Install

    npm i kath

    Weekly Downloads

    0

    Version

    0.0.5

    License

    MIT

    Unpacked Size

    7.92 kB

    Total Files

    11

    Last publish

    Collaborators

    • kuss