@creadev.org/cache
v0.3.1
Published
LRU cache with TTL and metrics
Readme
@creadev.org/cache
Cache - LRU, TTL cache
Install
npm install @creadev.org/cacheUsage
import { Cache, createCache, createLRU } from '@creadev.org/cache';
const cache = createCache({ maxSize: 100, ttl: 60000 });
await cache.set('key', 'value');
const value = await cache.get('key');
const has = await cache.has('key');API
| Function | Description |
|----------|-------------|
| createCache(options?) | Create TTL cache |
| createLRU(maxSize) | Create LRU cache |
| get(key) | Get cached value |
| set(key, value) | Set cached value |
License
MIT trigger
