Typesafe in-memory caching for Node.js
npm install @sayanbiswas/typedcache
import { TypedCache } from 'typedcache';
const cache = new TypedCache<string, number>({
debug: true,
timeoutMs: 3000,
})
cache.set('foo', 1);
cache.set('bar', 2);
console.log(cache.get('foo')); // 1
console.log(cache.get('bar')); // 2
console.log(cache.get('baz')); // undefined
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the terms of the MIT license.