@envelop/validation-cache
Version:
This plugins adds simple LRU caching to your `validate`, to improve performance by caching the validation result.
17 lines (16 loc) • 529 B
text/typescript
import { GraphQLError } from 'graphql';
import { type Plugin } from '@envelop/core';
export interface ValidationCache {
/**
* Get a result from the validation cache.
*/
get(key: string): readonly GraphQLError[] | undefined;
/**
* Set a result to the validation cache.
*/
set(key: string, value: readonly GraphQLError[]): void;
}
export type ValidationCacheOptions = {
cache?: ValidationCache;
};
export declare const useValidationCache: (pluginOptions?: ValidationCacheOptions) => Plugin;