cache-base
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@sellside/emitter | 1.2.1 | 4.41 kB | MIT | prod | |
collection-visit | 1.0.0 | 2.82 kB | MIT | prod | |
get-value | 3.0.1 | 5.47 kB | MIT | prod | |
has-own-deep | 1.1.0 | 2.69 kB | MIT | prod | |
kind-of | 6.0.3 | 7.47 kB | MIT | prod | |
set-value | 4.1.0 | 6.63 kB | MIT | prod | |
union-value | 1.0.1 | 2.67 kB | MIT | prod | |
unset-value | 1.0.0 | 3.09 kB | MIT | prod |
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.