basic-cache
The best node caching module ever.
Getting Started
Install the module with: npm install basic-cache
var cache = ;
Methods
set(key, value, time)
Sets a key
to a value
and have it expire in time
milliseconds.
cache;
get(key)
Gets the value of key
.
var company = cache;
reset(key[, time])
Resets the expiration time of the key
. You can optionally set a new time
.
cache; // Resets to current time + original 2000 cache; // Resets to current time + 1000
clear(key)
Removes the key
from the cache.
cacheclear'company';
clearAll()
Removes ALL the key
s from the cache.
cache;
clean()
If for some reason a key
's time
expired, but it still exists in the cache running this method will clear all of those key
s.
cache;
keys()
Returns all the names of the key
s in the cache as an array.
var keys = cache;
size()
Returns the number of key
s that are currently in the cache.
var size = cachesize;
Namespacing
var cache = ; cache;cache;
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
License
Copyright (c) 2013 MadGlory. Licensed under the MIT license.