strapi-hook-redis-connection
This hook connects to Redis and exposes the connection as a global service through strapi. It uses the ioredis package
This hook is compatible with the stable version (3.x) of Strapi only.
Installation
$ yarn add strapi-hook-redis-connection # or $ npm i strapi-hook-redis-connection --save
Configuration
To configure the hook edit or add the ./config/hook.js
file in your Strapi app. The config
object is passed to ioredis directly, consult ioredis docs for more info.
module timeout: 2000 settings: 'redis-connection': enabled: false config: host: // Redis host port: env // Redis port password: ;
Usage
Example to publish messages in a controller
moduleexports = index: async { const redis = strapiservicesredis; if ctxrequestbodymodel && ctxrequestbodyevent redis; // Send 200 `ok` ctx; };