In-memory caching module for JavaScript
$ npm install felix
# or
$ bower install felix
var felix = require('felix');
var cache = felix.create('example');
cache.put('foo', 123);
cache.put('bar', 456);
console.log(cache.get('foo')); // 123
console.log(cache.get('bar')); // 456
console.log(cache.size()); // 2
cache.remove('foo');
console.log(cache.size()); // 1
cache.clear();
console.log(cache.size()); // 0
The top level API for felix
is used to manage stored Cache
objects.
Construct a cache object identified by id
Get a cache object by it's identifier
Remove a cache by it's identifier
Clear all caches
The Cache
object is what is returned by felix.create
and felix.get
.
Put a key-value pair into the cache
Get the cached value for key
Remove the cached value for key
Clear all cached values
Get the size of the cache
Get all the cache keys
MIT