Package Exports
- rethinkdb-cache
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rethinkdb-cache) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
rethinkdb-cache
RDB warm cache module based upon https://gist.github.com/threepointone/62dd587d42819fc72284
How to use?
Simple, just install it, require it and use it
- Install it:
npm install rethinkdb-cache
- Require it:
/**
* @params {object} rdbSettings (optional)
* @params {string} tableName (optional)
*
*/
var rdbCache = require('rethinkdb-cache'),
CACHE = new rdbCache(rdbSettings, tableName);rdbSettings: RethinkDB connection settings
tableName: Name of the table you want to use as cache table
Usage:
if (!CACHE.retrieve(CACHE, "some-key")) {
// Not-in-cache-logic goes here...
CACHE.send(CACHE, "some-key", data);
}
else {
// Return from cache
var myData = JSON.parse(CACHE.retrieve("some-key")).val;
}