@graphql-mesh/cache-redis
Version:
15 lines (14 loc) • 722 B
TypeScript
import { type HivePubSub, type KeyValueCache, type KeyValueCacheSetOptions, type Logger, type MeshPubSub, type YamlConfig } from '@graphql-mesh/types';
import { DisposableSymbols } from '@whatwg-node/disposablestack';
export default class RedisCache<V = string> implements KeyValueCache<V>, Disposable {
private client;
constructor(options: YamlConfig.Cache['redis'] & {
pubsub?: MeshPubSub | HivePubSub;
logger: Logger;
});
[DisposableSymbols.dispose](): void;
set(key: string, value: V, options?: KeyValueCacheSetOptions): Promise<any>;
get(key: string): Promise<V | undefined>;
getKeysByPrefix(prefix: string): Promise<string[]>;
delete(key: string): Promise<boolean>;
}