UNPKG

@quell/server

Version:

Quell is an open-source NPM package providing a light-weight caching layer implementation and cache invalidation for GraphQL responses on both the client- and server-side. Use Quell to prevent redundant client-side API requests and to minimize costly serv

26 lines (25 loc) 1.01 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.redisCacheMain = void 0; const redis_1 = require("redis"); const dotenv_1 = __importDefault(require("dotenv")); dotenv_1.default.config(); // Create and export the Redis client instance const redisPort = Number(process.env.REDIS_PORT); const redisHost = process.env.REDIS_HOST; const redisPassword = process.env.REDIS_PASSWORD; exports.redisCacheMain = (0, redis_1.createClient)({ socket: { host: redisHost, port: Number(redisPort) }, password: redisPassword, }); // Handle errors during the connection exports.redisCacheMain.on("error", (error) => { console.error(`Error when trying to connect to redisCacheMain: ${error}`); }); // // Establish the connection to Redis // redisCacheMain.connect().then(() => { // // console.log("Connected to redisCacheMain"); // });