@jurijtokarski/cache
TypeScript icon, indicating that this package has built-in type declarations

0.7.0 • Public • Published

In-memory cache class

Install

npm i @jurijtokarski/cache or yarn add @jurijtokarski/cache.

Example

const cache = new Cache();

cache.get("example"); // => { value: null, status: 0 }

cache.set("example", [1, 2, 3], getMinutesInMS(10));

cache.get("example"); // => { value: [1, 2, 3], status: 2 }

// after 10 minutes

cache.get("example"); // => { value: [1, 2, 3], status: 1 }

Statuses

  • 0 means value was not set yet
  • 1 means value was set, but was expired
  • 2 means freash value

Definitions

Feel free to check TypeScript's definitions for package.

Readme

Keywords

none

Package Sidebar

Install

npm i @jurijtokarski/cache

Weekly Downloads

0

Version

0.7.0

License

MIT

Unpacked Size

5.08 kB

Total Files

7

Last publish

Collaborators

  • jurijtokarski