async-redis-shared

0.3.1 • Public • Published

async-redis-shared

⚠️ DEPRECATED / UNSUPPORTED: This package is no longer maintained.

This package has been replaced with https://www.npmjs.com/package/redis-singleton

A package that wraps redis-async, it adds a shared redis connection to global.ASYNC_REDIS_SHARED, when i have time i will write a singleton class unless i find another 1 that already does this.

Call once as early as possible in your app and await the promise response... then just import it

import the connector and connect

import connect from 'async-redis-shared/connect'
// Initialize Redis connection
connect(config.redis).catch((e) => {
  console.error('Error connecting to redis: ', e);
});

use elsewhere in your app

import client from 'async-redis-shared'
await client.set('key:unittest', String(now));
const fetchedVal = await client.get('key:unittest');

/async-redis-shared/

    Package Sidebar

    Install

    npm i async-redis-shared

    Weekly Downloads

    26

    Version

    0.3.1

    License

    none

    Unpacked Size

    15.6 kB

    Total Files

    20

    Last publish

    Collaborators

    • carmichael.john