Neanderthals Programming Machines
    Have ideas to improve npm?Join in the discussion! »

    @purpose/ttl-cache

    1.0.2 • Public • Published

    ttl-cache

    in-memory ttl cache. that's it

    install

    $ npm i @purpose/ttl-cache

    usage

    import c from '@purpose/ttl-cache';
     
    const cache = c();
    cache.set('foo', 'bar');
    console.log(cache.get('foo'));

    api

    cache([opts])

    create cache that keep items for opts.ttl || 300000 ms, and does cleanup every opts.interval || 60000 ms.

    cache.get(key)

    get item by key, or null if expired or missing

    cache.set(key, value)

    set item by key

    cache.length

    get current cache size (might contain expired items too)

    license

    MIT

    Install

    npm i @purpose/ttl-cache

    DownloadsWeekly Downloads

    2

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    2.82 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar