Skip to content
npm that simplifies page caching.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Assets
LICENSE
README.md
index.js
package.json

README.md

#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 of String 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 or Integer 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 or Integer to differentiate each key.

##Installation npm install redis-pages

##Author Lawrence Tran

##License See the LICENSE file for more info.

You can’t perform that action at this time.