Configurations
"modules": "hosts": "hostName"... or "hostName": ... "ttl": int // in seconds "options": Object
API: create
Cache create(String name)
Returns an instance of Cache class.
Cache class uses memcache.
Cache class
getOne
void get(String key, Function callback)
Read a value associated with the given key.
var peopleTable = gracenodemysql;var peopleCache = gracenodememcache;var sql = 'SELECT * FROM people WHERE name = ?';var params = 'bob';peopleCache;
getMany
void getMany(Array keyList, Function callback)
replace
void replace(String key, mixed value, Function callback)
set
void set(String key, mixed value, Function callback)
Sets a value associated with the given key.
var peopleTable = gracenodemysql;var peopleCache = gracenodememcache;var sql = 'SELECT * FROM people WHERE name = ?';var params = 'bob';peopleCache;
How to delete old cache
// delete old cache value on updated mysql datavar peopleTable = gracenodemysql;var peopleCache = gracenodememcache;var sql = 'UPDATE people SET age = ? WHERE name = ?';var params = 40 'bob';peopleTable;
del
void del(String key, Function callback)
flush
void flush(Function callback)