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

29 lines 1.6 kB
import type { InvalidateCacheConfig, ClearCacheFunction, DeleteCacheByIdFunction, ClearAllCachesFunction } from '../types/invalidateCacheTypes'; /** * Creates a clearCache middleware function that flushes the Redis cache * @param {InvalidateCacheConfig} config - Configuration containing the Redis client * @returns {Function} Express middleware function */ export declare function createClearCache(config: InvalidateCacheConfig): ClearCacheFunction; /** * Creates a function to remove a specific key-value from the cache * @param {InvalidateCacheConfig} config - Configuration containing the Redis client * @returns {Function} Function that deletes cache by ID */ export declare function createDeleteCacheById(config: Pick<InvalidateCacheConfig, 'redisCache'>): DeleteCacheByIdFunction; /** * Creates a function to clear the entire cache and reset the idCache * This is a utility function that combines both Redis and ID cache clearing * @param {InvalidateCacheConfig} config - Configuration containing the Redis client and ID cache * @returns {Function} Function that clears all caches */ export declare function createClearAllCaches(config: InvalidateCacheConfig): ClearAllCachesFunction; /** * FIX ME: * Flushes the Redis cache. To clear the cache from the client, establish an endpoint that * passes the request and response objects to an instance of QuellCache.clearCache. * @param {Object} req - Express request object. * @param {Object} res - Express response object. * @param {Function} next - Express next middleware function. */ //# sourceMappingURL=invalidateCache.d.ts.map