Prerender plugin for level caching, to be used with the prerender node application from https://github.com/prerender/prerender.
This plugin will store all prerendered pages into LevelDB.
In your local prerender project run:
$ npm install prerender-level-cache
Then in the server.js that initializes the prerender:
server.use(require('prerender-level-cache'));
It uses a default ttl of 2 months, but that can be overridden by setting a different value in prerender server.options.ttl
.
You can force a refresh from another plugin by setting req.refresh = true
Exemple:
// in another plugin placed before prerender-level-cache
module.exports = {
requestReceived: (req, res, next) => {
req.refresh = true
next()
}
}
Alternatively, you can delete the cache directly in the LevelDB database, using a tool such as lev2.
The plugin uses the level-party module to get over the level multi-process restrictions.