Socket
Book a DemoInstallSign in
Socket

lru-backup-cache

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lru-backup-cache

lru-backup-cache

1.0.1
latest
npmnpm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

lru-backup-cache

lru-cache wrapper with backup cache.

Cache module to take care of keeping a backup copy after key from the main cache is disposed off. Typical use case is to cache service response or any other data and in case of service failure, provide fallback to old value even after copy is disposed off from main cache.

Backup cache will only contain the values which are disposed off from main cache and again when you set the new value in cache, the backup cache will be cleaned off.

Example

    var Cache = require('lru-backup-cache');

    ....
    var cacheOptions = {
        enabled: true,       //By default true
        max: 1000,           //Max cache size
        maxAge: 1800 * 1000  //Max Age (in msec)
    };

    var cache = new Cache(cacheOptions);
    cache.set('foo', 'foo');
    console.log(cache.get('foo'));

Refer https://github.com/isaacs/node-lru-cache#options for more cacheOptions.

Keywords

lru cache

FAQs

Package last updated on 21 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.