# node-async-redis

> Async Redis for NodeJS

Latest version **1.0.1** (published 2019-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-async-redis
pnpm add node-async-redis
yarn add node-async-redis
bun add node-async-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 | 1.0.1 |
| Published | 2019-07-27 |
| First published | 2019-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Visalud Tantiwattanarom |
| Maintainers | loliconneko |
| Keywords | node-async-redis, redis, async |

## Links

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

## Dependencies (3)

- [redis](https://npm.io/package/redis.md) 2.8.0
- [dotenv](https://npm.io/package/dotenv.md) 8.0.0
- [redis-commands](https://npm.io/package/redis-commands.md) 1.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

- 1.0.1 (latest) — 2019-07-27

## README

Node Redis Async - async redis client for node.js
===========================
[![Build Status](https://travis-ci.org/WarmVissarutRonaldoDude/node-async-redis.svg?branch=master)](https://travis-ci.org/WarmVissarutRonaldoDude/node-async-redis)
[![npm](https://img.shields.io/npm/v/node-async-redis.svg)](https://www.npmjs.com/package/node-async-redis)
[![Coverage Status](https://coveralls.io/repos/github/WarmVissarutRonaldoDude/node-async-redis/badge.svg?branch=master)](https://coveralls.io/github/WarmVissarutRonaldoDude/node-async-redis?branch=master)

## How to install

```
yarn add node-async-redis
```
or
```
npm install node-async-redis
```

## How to use

### createRedisClient

Create redis client which expose all available redis command with async prefix.

Example:
```js
const redisClient = createRedisClient();
await redisClient.setAsync("string key", "string value");
```

Original functions still exist.

Example:
```js
redisClient.set("string key", "string value");
```

See all commands here : https://github.com/NodeRedis/redis-commands

#### Create async redis client with default config

Client will automatically created with default config and read connection config from `process.env`

```
process.env.REDIS_HOST=127.0.0.1
process.env.REDIS_PORT=6379
```

```js
const { createRedisClient } = require('node-async-redis');

const redisClient = createRedisClient();
redisClient.on("error", (error) => {
    console.log("Error : ", error);
})

const asyncFunction = async () => {
    await redisClient.setAsync("string key", "string value");
    const value = await redisClient.getAsync("string key");
    ...
}
```

#### Create async redis client with custom config

For available configuration please take a look here : https://github.com/NodeRedis/node_redis

```js
const { createRedisClient } = require('node-async-redis');
const redisClient = createRedisClient({
   host: "127.0.0.1"
   port: "6379",
   enable_offline_queue: false
});

redisClient.on("error", (error) => {
    console.log("Error : ", error);
})

const asyncFunction = async () => {
    await redisClient.setAsync("string key", "string value");
    const value = await redisClient.getAsync("string key");
    ...
}
```

### redis

Expose original redis module from : https://github.com/NodeRedis/node_redis

```js
const { redis } = require('node-async-redis');
const originalRedisClient = redis.createClient();
```

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