Redis module for Mono
Installation
npm install --save mono-redis
Then, in your configuration file of your Mono application (example: conf/application.js
):
moduleexports = mono: modules: 'mono-redis'
Configuration
Mono-Redis will use the redis
property of your configuration (example: conf/development.js
):
moduleexports = mono: redis: port: 8047 // See [options] of https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options
Usage
In your modules files, you can access redis
instance like this:
const redis = await redisconst hello = await redis// hello = 'world!'
We are using ioredis as a client since it supports async/await promises.