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

An easy way to handle in-memory key/value cache


Version published
Weekly downloads
79
decreased by-40.15%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

easy-cache Build Status

A simple NodeJS module to handle in-memory key/value cache.

Install

npm install easy-cache

Basic usage

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

cache.set('foo', 'bar');
console.log(cache.get('foo')); // 'bar'
console.log(cache.size()); // 1
cache.unset('foo');
console.log(cache.get('foo')); // null
console.log(cache.size()); // 0

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

setTimeout(function() {
  console.log(cache.get('temporary')); // null
  if (!cache.exists('temporary')) {
    console.log('Key does not exist');
  }
  cache.clear(); // remove all records
}, 150);

Credits

Inspired by node-cache.

Keywords

FAQs

Last updated on 12 Aug 2014

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