UNPKG

@matters/apollo-response-cache

Version:

Caching and invalidation mechanisms (plugins, directives) of Apollo GraphQL

29 lines (28 loc) 674 B
import type { Redis } from 'ioredis'; export type Node = { type: string; id: string; }; /** * Generate cache key of Node and FQC hashes array mapping * * e.g. ['Article', 18] -> 'node-fqcs:Article:18' */ export declare const toNodeFQCKey: (node: Node) => string; /** * Record Node:FQC mapping * */ export declare const recordNodeFQCMapping: ({ nodeFQCKeys, fqcKey, ttl, redis, }: { nodeFQCKeys: string[]; fqcKey: string; ttl: number; redis: Redis; }) => void; /** * Invalidate full query caches by the given related node keys */ export declare const invalidateFQC: ({ node, redis, }: { node: Node; redis: Redis; }) => Promise<void>;