cache-base
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
array-slice | 0.2.3 | 2.25 kB | MIT | prod | |
get-value | 0.2.2 | 3.15 kB | MIT | prod | |
kind-of | 0.1.2 | 3.18 kB | MIT | prod | |
lodash | 2.4.2 | 192.11 kB | MIT | prod | 1 2 2 1 |
option-cache | 0.1.4 | 4.52 kB | MIT | prod | 1 2 2 1 |
Cache Base is an efficient and customizable object caching utility designed for Node.js and JavaScript projects. It's a nifty tool that provides fundamental methods such as get
, set
, del
, and has
to help you manipulate project data effectively. Navigating nested properties is simple using dot notation, making it a beneficial resource in managing complex object structures.
To use Cache Base, download and install the package through NPM with the command $ npm install --save cache-base
. After which, you may then require Cache Base in your project file like const CacheBase = require('cache-base');
. Initialize a new Cache Base instance and use the provided methods to extract, manipulate, and check your data. Here is a simple usage example:
// Require the Cache Base library
const CacheBase = require('cache-base');
// Initialize a new Cache Base instance
const app = new CacheBase();
// Set data in the cache
app.set('a.b', 'c');
// Get data from the cache
console.log(app.get('a')); // Output: { b: 'c' }
console.log(app.get('a.b')); // Output: 'c'
You can also interact with cache data using events emitted from Cache Base:
app.on('set', function(key, val) {
// Do something when `set` is emitted
});
app.set('admin', true); // Triggers the 'set' event listener
You'll find all the details and additional configuration settings in the Cache Base GitHub repository. The README.md file on the repository contains an in-depth guide complete with usage examples and the complete API reference. This documentation helps you understand the optimal way to utilize Cache Base's functionalities to effectively manage your project's data.