Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 15, 2024 via pnpm

node-cache 5.1.2

Simple and fast NodeJS internal caching. Node internal in memory cache like memcached.
Package summary
Share
0
issues
1
license
2
MIT
Package created
20 Oct 2011
Version published
1 Jul 2020
Maintainers
2
Total deps
2
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
clone@2.1.2
node-cache@5.1.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of node-cache 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
clone2.1.25.68 kBMIT
prod

Visualizations

Frequently Asked Questions

What does node-cache do?

Node-cache is a simple, high-performance internal caching module for Node.js. It functions like the well-known Memcached solution, supporting set, get, and delete methods to manage the cache. Each key in the cache can have a defined timeout (Time to Live or TTL). After this time has expired, the key will automatically be eliminated from the cache. Node-cache features a practical limit of around one million keys as all keys are stored in a single object.

How do you use node-cache?

To use Node-cache, start by installing it in your project with NPM using the following command: npm install node-cache --save. Next, require it in your Node.js file and instantiate it:

const NodeCache = require( "node-cache" );
const myCache = new NodeCache();

You can store keys and retrieve them as follows:

// store a key
myCache.set("myKey", "myValue", 10000); // ttl is set to 10 seconds here

// retrieve a key
let value = myCache.get("myKey");

You can also delete keys using the del method and check if a key exists using the has method:

// delete a key
myCache.del("myKey");

// check if a key exists
let exists = myCache.has('myKey');

Where are the node-cache docs?

The Node-cache documentation can be found within the Node-cache repository on GitHub at git://github.com/node-cache/node-cache.git. The documentation covers every aspect of the package, from installation to usage examples, and includes in-depth explanations of every available method. It also provides event handling samples, warning about breaking changes in different versions, and compatibility information.