Skip to content
This repository has been archived by the owner on Dec 26, 2017. It is now read-only.

dollarshaveclub/fastboot-cluster-node-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A FastBoot app server cache built atop cluster-node-cache

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published