fastboot-cluster-node-cache

0.1.0 • Public • Published

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}`;
  }
});

Package Sidebar

Install

npm i fastboot-cluster-node-cache

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • dollarshaveclub-engineering