cachenow
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Cachenow

cachenow is a package to easily cache any type of data for a specific time. It works like a Map with a specific TTL for each entry.

Install

npm install cachenow

Usage

import CacheNow from 'cachenow';

const animalWeights = new CacheNow<number>(40 * 1000);

animalWeights.set('dog', 50); // Key = Value

animalWeights.get('dog') // returns 50

setTimeout(() => {
  animalWeights.get('dog') // returns null
}, 50 * 1000)

Todo

  • [x] Delete key from cache
  • [ ] Add option to save cache in a specific file
    • new CacheNow(5 * 1000, 'storage.json')

Readme

Keywords

Package Sidebar

Install

npm i cachenow

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

5.51 kB

Total Files

7

Last publish

Collaborators

  • larssv1
  • larrrssss