0.1.0 • Published 7 years ago

fastboot-cluster-node-cache v0.1.0

Weekly downloads
17
License
MIT
Repository
github
Last release
7 years ago

FastBoot Cluster Node Cache

This cache for the FastBoot App Server utilizes cluster-node-cache to cache the results of rendered FastBoot pages.

To use this cache:

const FastBootAppServer = require('fastboot-app-server');
const ClusterNodeCache = require('fastboot-cluster-node-cache');

let cache = new ClusterNodeCache();

let server = new FastBootAppServer({
  cache: cache,
  expiration: 60 // optional, defaults to 5 min.
});

Additionally, if you would like your cache key to vary based on information in the request (like headers), you can provide a cacheKey(path, request) function that takes in as parameters the path being requested and the request object.

let cache = new ClusterNodeCache({
  cacheKey(path, request) {
    return `${path}_${request && request.cookies && request.cookies.chocolateChip}`;
  }
});