# fastify-redis-io

> fastify ioredis

Latest version **0.0.2** (published 2018-11-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install fastify-redis-io
pnpm add fastify-redis-io
yarn add fastify-redis-io
bun add fastify-redis-io
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2018-11-21 |
| First published | 2018-11-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 500bits |
| Maintainers | kinhluan |
| Keywords | fastify, redis, ioredis |

## Links

- npm: https://www.npmjs.com/package/fastify-redis-io
- npm.io page: https://npm.io/package/fastify-redis-io

## Dependencies (1)

- [ioredis](https://npm.io/package/ioredis.md) ^4.2.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

- 0.0.2 (latest) — 2018-11-21
- 0.0.1 — 2018-11-21

## README

# fastify-ioredis

ioredis wrapper for fastify

[![ioredis](https://cdn.rawgit.com/luin/ioredis/57b5b89e3e9111ff25d8c62c0bc58ed42e5b8d1e/logo.svg)](https://github.com/luin/ioredis)

A robust, performance-focused and full-featured [Redis](http://redis.io) client for [Node.js](https://nodejs.org).

Supports Redis >= 2.6.12 and (Node.js >= 6).

To view full docs, please visit the [ioredis](https://github.com/luin/ioredis).

## Install
```
npm i -S fastify-ioredis
```

## Usage

```js
const fastify = require('fastify')()
const Redis = require('fastify-redis-io')

fastify.register(Redis,
    {
        port: 6379,          // Redis port
        host: '127.0.0.1',   // Redis host
    }, err => {
        if (err) throw err
    }
)

fastify.redis.set('foo', 'bar');
fastify.redis.get('foo', function (err, result) {
    console.log(result)
});

// Or using a promise if the last argument isn't a function
fastify.redis.get('foo').then(function (result) {
    console.log(result)
});

// Arguments to commands are flattened, so the following are the same:
fastify.redis.sadd('set', 1, 3, 5, 7)
redis.sadd('set', [1, 3, 5, 7])

// All arguments are passed directly to the redis server:
fastify.redis.set('key', 100, 'EX', 10)

fastify.get('/', async (request, reply) => {
    reply.type('application/json').code(200)
    return {
        name: 'fastify-ioredis',
        version: '0.0.1'
    }
})

const start = async () => {
    try {
        await fastify.listen(3000)
    } catch (err) {
        fastify.log.error(err)
        process.exit(1)
    }
}

start()
```

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