# fortune-redis

> Redis adapter for fortune

Latest version **2.1.0** (published 2017-01-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install fortune-redis
pnpm add fortune-redis
yarn add fortune-redis
bun add fortune-redis
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2017-01-21 |
| First published | 2015-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.12 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Maintainers | thibremy |
| Keywords | fortune, redis, adapter |

## Links

- npm: https://www.npmjs.com/package/fortune-redis
- Repository: https://github.com/thibremy/fortune-redis
- Homepage: https://github.com/thibremy/fortune-redis#readme
- Issues: https://github.com/thibremy/fortune-redis/issues
- npm.io page: https://npm.io/package/fortune-redis

## Dependencies (1)

- [ioredis](https://npm.io/package/ioredis.md) ^2.5.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2017-01-21
- 1.0.3 (release) — 2015-10-26
- 1.0.2 (beta) — 2015-10-26
- 2.0.1 — 2016-09-08
- 2.0.0 — 2016-09-08
- 1.0.7 — 2015-11-30
- 1.0.6 — 2015-11-30
- 1.0.5 — 2015-11-30
- 1.0.4 — 2015-10-26
- 1.0.1 — 2015-10-26

## README

[![Code Climate](https://codeclimate.com/github/thibremy/fortune-redis/badges/gpa.svg)](https://codeclimate.com/github/thibremy/fortune-redis)

# Fortune Redis Adapter

This is a [Redis](https://http://redis.io) adapter for [Fortune](http://fortune.js.org).
This package now use [ioredis](https://github.com/luin/ioredis) instead of [node_redis](https://github.com/NodeRedis/node_redis)

## Usage

Install the `fortune-redis` package from `npm`:

```git 
$ npm install fortune-redis
```

Then use it with Fortune:

```js
import fortune from 'fortune'
import redisAdapter from 'fortune-redis'

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


## Adapter Options


Event    | Description
:------------- | :-------------
generateId   | Generate 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.
reateClientFactory    | see below


Any node.js redis client library that conforms (or when adapted) to [ioredis](https://github.com/luin/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](https://github.com/stipsan/ioredis-mock).

```js
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.

---
_Source: https://npm.io/package/fortune-redis · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
