async-redis-shared

0.2.1 • Public • Published

async-redis-shared

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');

Readme

Keywords

Package Sidebar

Install

npm i async-redis-shared

Weekly Downloads

38

Version

0.2.1

License

none

Unpacked Size

15.4 kB

Total Files

20

Last publish

Collaborators

  • carmichael.john