nickschot / lux-redis-cache

[WIP] Middleware implementation of a redis based cache for Lux
MIT License
8 stars 1 forks source link

new: add enabled option (fixes #8) #9

Closed jamemackson closed 7 years ago

jamemackson commented 7 years ago

this PR adds a boolean enabled option to the getFromRedis middleware function, which inherently also disables the addToRedis function as the request param to trigger the caching never gets set.

The option is enabled by default.

example usage:

getFromRedis(redis, {
  naiveCacheExpiry: false,
  enabled: process.env.REDIS_CACHE_ENABLED || true
})