prerender-filesystem-cache

1.0.1 • Public • Published

prerender-filesystem-cache Build Status

Status

Build Status Coverage Status

This is a plugin for prerender(.io) providing caching in the file system. This plugin is a fork of https://github.com/suhanovv/prerender-file-cache, focussing on improved URI parsing, platform-independency and providing test coverage.

Requires node >= 0.11.

The version 1.0.0 of this plugin and all its hotfixes target the prerender phantomjs branch (version 4.4.x).

How it works

This plugin will store all prerendered pages into a filesystem hierarchy. For example:

  • url http://domain.lo/?escaped_fragment=/en/about - will be saved in CACHE_ROOT_DIR/en/about/perender.cache.html
  • url http://domain.lo/en/about?escaped_fragment= - will be saved in CACHE_ROOT_DIR/en/about/perender.cache.html
  • url http://domain.lo/?escaped_fragment=/en/main/path/blah - will be saved in CACHE_ROOT_DIR/en/main/path/blah/perender.cache.html
  • url http://domain.lo/en/main/path/blah?escaped_fragment= - will be saved in CACHE_ROOT_DIR/en/main/path/blah/perender.cache.html

How to use

In your local prerender project run:

$ npm install prerender-filesystem-cache --save

Then in the server.js that initializes the prerender:

server.use(require('prerender-filesystem-cache'));

Configuration

Optionally, define some env variables:

export CACHE_ROOT_DIR=/your/directory/for/cache  
export CACHE_LIVE_TIME=10000 (in seconds)
  • CACHE_ROOT_DIR defaults to os.tmpdir()/prerender-cache
  • CACHE_LIVE_TIME defaults to 3600 (1 hour)

Package Sidebar

Install

npm i prerender-filesystem-cache

Weekly Downloads

1

Version

1.0.1

License

BSD-3-Clause

Unpacked Size

15 kB

Total Files

9

Last publish

Collaborators

  • matthesrieke