@graphql-mesh/plugin-response-cache
Version:
31 lines (30 loc) • 1.01 kB
TypeScript
import type { GatewayPlugin } from '@graphql-hive/gateway-runtime';
import type { KeyValueCache, YamlConfig } from '@graphql-mesh/types';
import type { UseResponseCacheParameter } from '@graphql-yoga/plugin-response-cache';
export type ResponseCacheConfig = Omit<UseResponseCacheParameter, 'cache'> & {
/**
* The Mesh cache instance to use for storing the response cache.
*
* The cache should be provided from the Mesh context:
* ```ts
* defineConfig({
* plugins: ctx => [
* useMeshResponseCache({ ...ctx })
* ]
* })
* ```
*/
cache: KeyValueCache;
};
/**
* Response cache plugin for GraphQL Mesh
* @param options
*/
export default function useMeshResponseCache(options: ResponseCacheConfig): GatewayPlugin;
/**
* @deprecated Use new configuration format `ResponseCacheConfig`
* @param options
*/
export default function useMeshResponseCache(options: YamlConfig.ResponseCacheConfig & {
cache: KeyValueCache;
}): GatewayPlugin;