4.0.2 • Published 6 months ago

simple-redis-service v4.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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

ParamTypeDescription
servicesObjectThe services to inject
services.ENVObjectAn environment object
services.REDISfunctionThe configuration object as given to node-redis
services.REDIS_PASSWORD_ENV_NAMEfunctionThe environment variable name in which to pick-up the Redis password
services.logfunctionA 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

4.0.2

6 months ago

4.0.1

9 months ago

4.0.0

9 months ago

3.0.0

9 months ago

2.0.2

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago