rosmaro-redis-storage

1.1.0 • Public • Published

Redis backed storage for Rosmaro

This package makes it possible to store Rosmaro data in Redis.

Installation

$ npm i rosmaro-redis-storage --save

Building a storage

First you will need a Redis client. For details on how to get it please check the documentation of the redis package.

Then you can build a storage like this:

const make_redis_backed_storage = require('rosmaro-redis-storage')

const redis_backed_storage = make_redis_backed_storage({
  redis_client: the_redis_client_to_use,
  key: all_the_data_is_stored_under_this_redis_key
})

The ttl option makes it possible to set the time to live of the stored data:

const redis_backed_storage = make_redis_backed_storage({
  redis_client,
  key,
  ttl: 500 //milliseconds
})

The key parameter

Please note that the provided key is used as it is, without any changes. So if you already have something stored under this key, it's going to be overriden. A situation like that may occur if you use the rosmaro-redlock package and provide the same value as the resource parameter.

Readme

Keywords

Package Sidebar

Install

npm i rosmaro-redis-storage

Weekly Downloads

1

Version

1.1.0

License

MIT

Last publish

Collaborators

  • lukaszmakuch