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

45 lines 2.26 kB
import { Response, Request, NextFunction, RequestHandler } from "express"; import { RedisClientType } from "redis"; import { RedisOptionsType } from "../types/types"; /** * Reads from Redis cache and returns a promise (Redis v4 natively returns a promise). * @param {string} key - The key for Redis lookup. * @returns {Promise} A promise representing the value from the redis cache with the provided key. */ export declare const getFromRedis: (key: String, redisCache: RedisClientType) => Promise<string | null | void>; /** * Returns a chain of middleware based on what information (if any) the user would * like to request from the specified redisCache. It requires an appropriately * configured Express route and saves the specified stats to res.locals, for instance: * @example * app.use('/redis', getRedisInfo({ * getStats: true, * getKeys: true, * getValues: true * })); * @param {Object} options - Three properties with boolean values: getStats, getKeys, getValues * @returns {Array} An array of middleware functions that retrieves specified Redis info. */ export declare const getRedisInfo: (options?: RedisOptionsType) => RequestHandler[]; /** * Gets the key names from the Redis cache and adds them to the response. * @param {Object} req - Express request object. * @param {Object} res - Express response object. * @param {Function} next - Express next middleware function. */ export declare const getRedisKeys: (req: Request, res: Response, next: NextFunction) => void; /** * Gets the values associated with the Redis cache keys and adds them to the response. * @param {Object} req - Express request object. * @param {Object} res - Express response object. * @param {Function} next - Express next middleware function. */ export declare const getRedisValues: (req: Request, res: Response, next: NextFunction) => void; /** * Gets information and statistics about the server and adds them to the response. * @param {Object} req - Express request object. * @param {Object} res - Express response object. * @param {Function} next - Express next middleware function. */ export declare const getStatsFromRedis: (req: Request, res: Response, next: NextFunction) => void; //# sourceMappingURL=redisHelpers.d.ts.map