Skip to content

nfroidure/redis-kv-store

Repository files navigation

redis-kv-store

A simple Redis based key/value store.

GitHub license

This simple project provides a key/value store based on Redis. It has the exact same API then the memory-kv-store module and relies on the redis-service module.

API

initRedisKV(services) ⇒ Promise.<RedisKVService>

Instantiate the Redis Key/Value service

Kind: global function
Returns: Promise.<RedisKVService> - A promise of the Redis Key Value service

Param Type Description
services Object The services to inject
services.redis function A simple-redis-service instance
services.log function A logging function

Example

import initRedisService from 'simple-redis-service';
import initRedisKV from 'redis-kv-store';

const redis = await initRedisService({
  REDIS: {
    host: 'localhost',
    port: 6379,
  },
  ENV: process.env,
  log: console.log.bind(console),
});
const redisKV = await initRedisKV({
  redis,
  log: console.log.bind(console),
});

const value = await redisKV.get('my_key');

Authors

License

MIT