Dank-del / typedcache

Typesafe cache for Node.js

Home Page:https://www.npmjs.com/package/@sayanbiswas/typedcache

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

typedcache

Typesafe in-memory caching for Node.js

Installation

npm install @sayanbiswas/typedcache

Usage

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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the terms of the MIT license.

About

Typesafe cache for Node.js

https://www.npmjs.com/package/@sayanbiswas/typedcache

License:MIT License


Languages

Language:TypeScript 100.0%