So I have installed Redis following this guide from digital ocean:
I have it running on local server to mirror what will happen in development, however, now the problem is that all pages get cached, and changes I make in development mode also get cached.
Is there a good work around for this? Should I define Development and Production variables in my build script, and then use boolean logic to turn redis off and on with that? The problem is that redis is implemented in all my routes… So I am not sure how that will work.
Here is how I call Redis in Express:
var cache = require('express-redis-cache')({
auth_pass: process.env.PREDISP
});
cache.on('error', function (error) {
throw new Error('Cache error!');
});
And then to cache a route:
router.get("/", cache.route(), ctrl.homePage);
Thanks for any help on how to turn redis off for development.