node-async-redis

    1.0.1 • Public • Published

    Node Redis Async - async redis client for node.js

    Build Status npm Coverage Status

    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:

    const redisClient = createRedisClient();
    await redisClient.setAsync("string key", "string value");

    Original functions still exist.

    Example:

    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
    
    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

    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

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

    Install

    npm i node-async-redis

    DownloadsWeekly Downloads

    30

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    4.5 kB

    Total Files

    4

    Last publish

    Collaborators

    • loliconneko