node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

expressjs-redis-cache

ExpressJS Redis Cache v0.0.7

Simple application level cache middleware using Redis as the cache store.

How do I get set up?

Installation is simple:

npm install expressjs-redis-cache

Usage

redisCache = require('express-redis-cache')
...
// insert before app.router middleware
app.use(redisCache.createCache(options));
app.use(app.router)
 

Options All of the options are optional and have appropriate defaults

  • client (default: null)
    • provide an already connected redis client
  • redisConnString (default: localhost)
    • Connection String for the Redis Instance if client isn't provided
  • cacheDuration (default: 60*5)
    • How long Responses are cached for
  • cacheControl (default: "public")
    • Sets the Cache-Control HTTP Header
  • cacheExceptions (default: [])
    • Array of routes which should be excluded from the cache. E.g. ['/admin/*', '/private']