1.0.2 • Published 1 year ago

cachelib-js v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

JS Cache library that allows to store data and setup TTL.

Usage:

const { CacheService } = require('cachelib-js');

const cacheService = new CacheService;

// subscribe to service events (SET, GET, REMOVE)
cacheService.addListener(CacheService.events.SET, (event) => { /* response on SET event */ });

// set value to cache which will be non-actual after 10 sec
cacheService.set('key', { value: 'any value' }, { ttl: 10000 });

// get value
const result = cacheService.get('key');

// remove value
cacheService.remove('key');

// extract full data
const fullCacheData = cacheService.extract();

// preload data to service
cacheService.load(fullCacheData);
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago