2.1.0 • Published 8 years ago

fortune-redis v2.1.0

Weekly downloads
12
License
MIT
Repository
github
Last release
8 years ago

Code Climate

Fortune Redis Adapter

This is a Redis adapter for Fortune. This package now use ioredis instead of node_redis

Usage

Install the fortune-redis package from npm:

$ npm install fortune-redis

Then use it with Fortune:

import fortune from 'fortune'
import redisAdapter from 'fortune-redis'

const store = fortune({...},  {
  adapter: [
    redisAdapter,
    {
      url: 'redis://:authpassword@127.0.0.1:6380'
    }
  ]
})

Adapter Options

EventDescription
generateIdGenerate the _id key on a new document. It must be a function that accepts one argument, the record type, and returns a unique string or number. Optional.
reateClientFactorysee below

Any node.js redis client library that conforms (or when adapted) to ioredis API can be injected into fortune-redis. You should only provide a createClientFactory function as a redis connection factory instead of providing ioredis connection options.

Below is a sample code to use fortune-redis with ioredis-mock.

import fortune from 'fortune'
import redisAdapter from 'fortune-redis'
import RedisMock from 'ioredis-mock'

const store = fortune({...},  {
  adapter: [
    redisAdapter,
    {
      createClientFactory() {
        return new RedisMock()
      }
    }
  ]
})

License

This software is licensed under the MIT License.

2.1.0

8 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago