Instantiate the Redis service
Kind: global function
Returns: Promise.<RedisService> - A promise of the Redis service
| Param | Type | Description |
|---|---|---|
| services | Object |
The services to inject |
| [services.ENV] | Object |
An environment object |
| services.REDIS | function |
The configuration object as given to node-redis |
| [services.REDIS_PASSWORD_ENV_NAME] | function |
The environment variable name in which to pick-up the Redis password |
| services.log | function |
A logging function |
Example
import initRedisService from 'simple-redis-service';
const redis = await initRedisService({
REDIS: {
host: 'localhost',
port: 6379,
},
ENV: process.env,
log: console.log.bind(console),
});
const value = await redis.get('my_key');