New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

ncache

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ncache

Memcache system for node js

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

node-cache

Memcache system for node js. ncache allows servers to store in memory data using the key value pattern, this elements will be in memory until they expire.

Using node-cache

Install it in your node server using npm install ncache - https://npmjs.org/package/ncache

  • set
  • get
  • remove
### set(key, value, seconds) Stores in the cache the value using the key as index (if the key exists it will overrite it). The entry will expire based on the number of seconds it receive

Usage:

var Cache = require("ncache");
var foo = {
    id: 10,
    name, "FOO"
};
Cache.set(foo.id, foo, 25);         /* foo will be in memcache for 25 seconds, and we will acces it with its id*/
### set(key) Returns the value stored with the key if exists, if not it will return null

Usage:

var Cache = require("ncache");
var foo = {
    id: 10,
    name, "FOO"
};
Cache.set(foo.id, foo, 25);
Cache.get(10);                      /* Returns {id:10, name: "foo"} if the countdown hasn't finished, else null */
### remove(key) Removes from the cache, if the element was in cache it will return true, if it wasn't false

Usage:

var Cache = require("ncache");
var foo = {
    id = 10;
    name = "FOO"
};
Cache.set(foo.id, foo, 25);

Cache.remove(10);                   /* Returns true if it is still in cache, if it isn't false */

Cache.get(10);                      /* Returns null */

Keywords

cache

FAQs

Package last updated on 13 Apr 2013

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