UNPKG

@notross/redis-hub

Version:

A minimal connection hub for Redis in Node.js

17 lines 598 B
import { RedisHub } from './redis-hub'; // Global guard so multiple loads still share one hub in the same runtime const GLOBAL_KEY = Symbol.for('notross.redis-hub'); function getSharedHub() { // @ts-ignore if (!globalThis[GLOBAL_KEY]) { // @ts-ignore globalThis[GLOBAL_KEY] = new RedisHub(); } // @ts-ignore return globalThis[GLOBAL_KEY]; } const redisHub = getSharedHub(); export default redisHub; export const redisClient = redisHub.client.bind(redisHub); export const defaultClient = redisHub.getDefaultClient.bind(redisHub); //# sourceMappingURL=index.js.map