1.0.4 • Published 4 years ago
loopback-redis-cache-v2 v1.0.4
loopback-redis-cache-v2
Redis cache mixin for loopback.io
Features
- Cache every GET request using only one get option.
- Different Redis server for each model with fallback to config.json Redis server.
- Invalidate cache on every create, update or delete.
Installation
loopback-redis-cache-v2 requires Node.js v4+ to run.
Install using npm
$ npm install loopback-redis-cache-v2 --save
Add to /server/model-config.json
"mixins": [
...
"../node_modules/loopback-redis-cache-v2"
...
]
Plugins
loopback-redis-cache is currently extended with the following plugins.
Plugin | README |
---|---|
redis | https://github.com/NodeRedis/node_redis/blob/master/README.md |
redis-delete-pattern | https://github.com/uber-archive/redis-delete-pattern/blob/master/README.md |
How to use it
Create a file redis-config.js in /server/
const config = {
host: 'xxx.xxx.xxx.xxx',
password: 'xxxxxxx',
ttl: 300
};
module.exports = config;