@graphql-mesh/cache-redis
Version:
18 lines (17 loc) • 802 B
text/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;
private tracer;
private iamRefreshTimer?;
private iamInitPromise?;
constructor(options: YamlConfig.Cache['redis'] & {
pubsub?: MeshPubSub | HivePubSub;
logger: Logger;
});
[DisposableSymbols.dispose](): void;
set(key: string, value: V, options?: KeyValueCacheSetOptions): Promise<void>;
get(key: string): Promise<V | undefined>;
getKeysByPrefix(prefix: string): Promise<string[]>;
delete(key: string): Promise<boolean>;
}