@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
38 lines • 1.41 kB
TypeScript
import type { ProtoObjType, ItemFromCacheType } from './types';
/**
* Function signature for buildFromCache
*/
export type BuildFromCacheFunction = (prototype: ProtoObjType, prototypeKeys: string[], itemFromCache?: ItemFromCacheType, firstRun?: boolean, subID?: boolean | string) => Promise<{
data: ItemFromCacheType;
}>;
/**
* Function signature for generateCacheID
*/
export type GenerateCacheIDFunction = (queryProto: ProtoObjType) => string;
/**
* Cache response structure
*/
export interface CacheResponse {
data: ItemFromCacheType;
cacheHit?: "full" | "partial" | "none";
}
/**
* Redis command callback function type
*/
export type RedisCommandCallback = (cacheResponse: string) => void;
/**
* Helper function signatures
*/
export interface ReadCacheHelpers {
getCacheIDWithFallback: (prototype: ProtoObjType, subID?: boolean | string) => string;
processArrayCache: (array: string[], prototype: ProtoObjType, typeKey: string, prototypeKeys: string[], itemFromCache: ItemFromCacheType) => Promise<void>;
processNestedCache: (prototype: ProtoObjType, typeKey: string, itemFromCache: ItemFromCacheType, prototypeKeys: string[], firstRun: boolean) => Promise<void>;
}
/**
* Redis multi queue type (simplified for our use case)
*/
export interface RedisMultiQueue {
get(key: string): void;
exec(): Promise<Array<unknown>>;
}
//# sourceMappingURL=readCacheTypes.d.ts.map