1.0.2 • Published 5 years ago

@purpose/ttl-cache v1.0.2

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

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

1.0.2

5 years ago

1.0.1

8 years ago

1.0.0

8 years ago