prc

prerender-redis-cache

Prerender plugin for Redis caching

Showing:

Popularity

Downloads/wk

10

GitHub Stars

30

Maintenance

Last Commit

1yr ago

Contributors

7

Package

Dependencies

1

Size (min+gzip)

16.4KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

prerender-redis-cache

Prerender plugin for Redis caching, to be used with the prerender node application from https://github.com/prerender/prerender.

How it works

This plugin stores pages returned through prerender in a redis instance. Currently, it caches the pages for 1 day then expires them. This can be overridden by specifying the env variable "process.env.PAGE_TTL" in seconds. To never expire you should set the PAGE_TTL variable to 0.

How to use

In your local prerender project run:

$ npm install prerender-redis-cache --save

Then in the server.js that initializes the prerender:

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

Configuration

By default it will connect to your Redis instance running on localhost and the default redis port with no authentication, and the default database number (normally 0). You can overwrite this by setting the REDISTOGO_URL, REDISCLOUD_URL, REDISGREEN_URL or REDIS_URL (in the format redis://user:password@host:port/databaseNumber). This currently covers all heroku add-ons for Redis to support quick start.

Acknowledgements

Thanks to the following for making branches with changes which were merged with the 0.2.0 release.

Fantastic Prerender team.

@nelsonkopliku

@eddietio

@irnc

Todo

  • Slightly finer-grain error catching to make sure this plugin doesn't crash prerender for any reason.
  • Make POST request to a URL clear the cache in line with a few other plugins

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100