simple-redis-service
TypeScript icon, indicating that this package has built-in type declarations

4.0.2 • Public • Published

simple-redis-service

A simple Redis wrapper around the ioredis module.

GitHub license Coverage Status

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.

API

initRedisService(services) ⇒ Promise.<RedisService>

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');

Authors

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i simple-redis-service

Weekly Downloads

144

Version

4.0.2

License

MIT

Unpacked Size

20.4 kB

Total Files

12

Last publish

Collaborators

  • nfroidure