A simple Redis wrapper around the ioredis module.
npm install simple-redis-service[//]: # ( )
[//]: # (This file is automatically generated by a metapak)
[//]: # (module. Do not change it except between the)
[//]: # (content:start/end flags, your changes would)
[//]: # (be overridden.)
[//]: # ( )

[//]: # (::contents:start)
This simple project is intended to mock real key value stores likes Redis or
file system based stores. It can also be used in local scripts to run code
that assume a key value store exists.
It requires a delay services to be passed in, you can find an implementation
in the common-services
project.
[//]: # (::contents:end)
Promise.<RedisService>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
``js
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');
``