1.0.1 • Published 3 years ago

s-memory-cache v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

simple-memory-cache

A simple memory cache for javascript with no dependencies, built with ES6 proxy

How to install

npm i s-memory-cache

How to use

Basic use:

const initCache = require('s-memory-cache');

const cacheObj = initCache({ refreshCache: 15000, refreshCacheElem: 5000 });

cacheObj['cacheKey1'] = 'hello world';
cacheObj['cacheKey2'] = 'こんにちは世界';

Cache anything you want in cacheObj

The initCache function have two optional parameters:

  • refreshCache: When will the whole cache be reset (in ms)
  • refreshCacheElem: When will the created cache element be reset (in ms)

When the cache element is reset it become null