1.0.8 • Published 6 years ago

cache-ttl v1.0.8

Weekly downloads
25
License
ISC
Repository
github
Last release
6 years ago

cache-ttl

npm version npm downloads

The key-value storage with TTL (time to live) support, allowing you to add, modify or delete stored data items.

Install

$ npm install cache-ttl

How to use

JavaScript:

const cache = require('cache-ttl').Cache;
// OR const cache = require('cache-ttl').default;
// OR const { Cache } = require('cache-ttl');

cache.set('foo', 'bar');
console.log(cache.get('foo'));

TypeScript:

import Cache from 'cache-ttl';
// OR import { Cache } from 'cache-ttl';

Cache.set('foo', 'bar');
console.log(Cache.get<string>('foo'));

Advanced usage

Cache.set('foo', 'bar', 10); // Will expire after 10 seconds
Cache.count(); // Count items
Cache.remove('foo'); // Remove item by key
Cache.clear(); // Flush cache
1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago