0.1.2 • Published 10 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
ArrayofStringitems to cache. - ItemsPerPage - An
Intvalue denoting the number of items in each page. - Key - A
Stringdenoting the name of the item in the cache. - Stamp - An optional
StringorIntegerto differentiate each key.
getPage(params = {}, callback)Returns a single page.
######Parameters
- Client - A redis client.
- Key - A
Stringdenoting the name of the item in the cache. - Index - An
Integervalue 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
Stringdenoting the name of the item in the cache. - Stamp - An optional
StringorIntegerto differentiate each key.
##Installation
npm install redis-pages
##Author Lawrence Tran
##License See the LICENSE file for more info.