0.1.2 • Published 8 years ago
redis-pages v0.1.2
#Redis Pages
Redis pages is a simply interface for caching page based content in redis.
##Usage
var redis = require('redis');
var redisPages = require('redis-pages');
var client = redis.createClient();
// An array of items
var items = [];
var params = {
Client : client,
Items : items,
ItemsPerPage: 10,
Key: 'MyKey',
Stamp: null
}
redisPages.setPages(params, function(err, result) {
if (err) {
console.log(err);
} else {
console.log(result);
}
});
##Documentation
setPages(params = {}, callback)
Caches pages. Note currently you cannot overwrite an existing key with setPages()
. You must call deletePages()
before doing so. Overwriting will be included in future updates.
######Parameters
- Client - A redis client.
- Items - An
Array
ofString
items to cache. - ItemsPerPage - An
Int
value denoting the number of items in each page. - Key - A
String
denoting the name of the item in the cache. - Stamp - An optional
String
orInteger
to differentiate each key.
getPage(params = {}, callback)
Returns a single page.
######Parameters
- Client - A redis client.
- Key - A
String
denoting the name of the item in the cache. - Index - An
Integer
value denoting the index of the page content. Starts from 0.
deletePages(params = {}, callback)
Deletes a group of pages.
######Parameters
- Client - A redis client.
- Key - A
String
denoting the name of the item in the cache. - Stamp - An optional
String
orInteger
to differentiate each key.
##Installation
npm install redis-pages
##Author Lawrence Tran
##License See the LICENSE file for more info.