What does?
InCache is a module that store any info in memory, it can be used for example for storing server sessions, caching http response or sharing singleton object in your apps.
It also give you the possibility to save data on disk so you can avoid the data loss when the process exit or restart.
Installation
Node.js
npm install incache --save
Example
const InCache = require('incache');
const store = new InCache();
store.set('my key', 'my value');
store.set('my key', {a: 1, b: 2});
store.remove('my key');
store.clear();
incache.set('my string', 'hello world', {maxAge: 2000});
incache.set('my string', 'hello world', {expires: '2028-08-22 12:00:00'});
Some events
incache.on('remove', key => {
console.log(key);
});
incache.on('create', (key, record) => {
console.log(key, record);
});
incache.on('update', (key, record) => {
console.log(key, record);
});
API
Please see the full documentation for more details.
Browser
Local
<script src="node_modules/incache/dist/incache.min.js"></script>
CDN unpkg
<script src="https://unpkg.com/incache/dist/incache.min.js"></script>
CDN jsDeliver
<script src="https://cdn.jsdelivr.net/npm/incache/dist/incache.min.js"></script>
Changelog
You can view the changelog here
License
InCache is open-sourced software licensed under the MIT license
Author
Fabio Ricali
Contributor
Davide Polano