Async Redis for NodeJS
npm install node-async-redisNode Redis Async - async redis client for node.js
===========================



```
yarn add node-async-redis`
or`
npm install node-async-redis
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");
...
}
`
Expose original redis module from : https://github.com/NodeRedis/node_redis
`js``
const { redis } = require('node-async-redis');
const originalRedisClient = redis.createClient();