Egg.js plugin providing Redis client integration via ioredis. Current version 2.6.1, supports Node >= 6.0.0 and Egg.js applications. Enables single or multiple Redis clients, Sentinel support, and custom ioredis versions. Primarily maintained by the Egg.js core team with monthly releases. Key differentiator: seamless integration with Egg.js lifecycle, supports weakDependent option to not block app startup, and enables per-client configuration. Based on ioredis, so all ioredis features (cluster, pipelining, etc.) are available.
npm install egg-redisNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic setup of egg-redis plugin: install, enable, configure single client, and use in a controller with set/get.
Do not require/import egg-redis directly. Enable it in config/plugin.js and use app.redis.
Use config.redis = { client: { host, port, ... } } for single client, or config.redis = { clients: { instanceName: { ... } } } for multi clients.Set password to null explicitly if no auth is needed (e.g., password: null).
To use a custom ioredis version, set config.redis.Redis = require('ioredis') with the desired version.Only use weakDependent when Redis is truly optional. Otherwise ensure Redis is reachable.
Run npm install egg-redis --save and ensure it is in dependencies.
Start Redis server (e.g., redis-server) or verify host/port in config.
Check config/plugin.js: exports.redis = { enable: true, package: 'egg-redis' }; and verify config/config.default.js has valid redis client config.Run npm install ioredis --save (or reinstall egg-redis).