Socket
Socket
Sign inDemoInstall

easy-cache

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    easy-cache

A simple NodeJS module to handle in-memory cache


Version published
Weekly downloads
138
increased by0.73%
Maintainers
1
Install size
2.04 kB
Created
Weekly downloads
 

Readme

Source

easy-cache

An easy way to handle in-memory cache.

Install

npm install easy-cache

Basic usage

var cache = require('easy-cache');

cache.set('foo', 'bar');
console.log(cache.get('foo')); // output: bar
cache.unset('foo'); // remove specific record

cache.set('temporary', 'value', 100); // duration in ms
console.log(cache.get('temporary')); // output: value

setTimeout(function() {
  try {
    console.log(cache.get('temporary')); // throws an exception
  } catch(err) {
    console.log(err.message);
  }
}, 150);

if (!cache.exists('temporary')) {
  console.log('Key does not exist');
}

cache.clear(); // remove all records

Credits

Inspired by node-cache.

FAQs

Last updated on 14 Dec 2012

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc