loopback-redis-cache-v2

1.0.4 • Public • Published

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;

Package Sidebar

Install

npm i loopback-redis-cache-v2

Weekly Downloads

4

Version

1.0.4

License

MIT

Unpacked Size

4.57 kB

Total Files

3

Last publish

Collaborators

  • shandye2