UNPKG

@stewartmcgown/apollo-response-cache

Version:

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

14 lines (13 loc) 772 B
import { KeyValueCache } from 'apollo-server-caching'; import { ApolloServerPlugin } from 'apollo-server-plugin-base'; import { GraphQLRequestContext, ValueOrPromise } from 'apollo-server-types'; interface Options<TContext = Record<string, any>> { cache?: KeyValueCache; sessionId?(requestContext: GraphQLRequestContext<TContext>): ValueOrPromise<string | null>; extraCacheKeyData?(requestContext: GraphQLRequestContext<TContext>): ValueOrPromise<any>; shouldReadFromCache?(requestContext: GraphQLRequestContext<TContext>): ValueOrPromise<boolean>; shouldWriteToCache?(requestContext: GraphQLRequestContext<TContext>): ValueOrPromise<boolean>; nodeFQCTTL: number; } export default function plugin(options?: Options): ApolloServerPlugin; export {};