layered-loader
Version:
Data loader with support for caching and fallback data sources
20 lines (19 loc) • 865 B
TypeScript
import type { Redis } from 'ioredis';
import type { CommonCacheConfiguration } from '../types/DataSources';
export interface RedisCacheConfiguration extends CommonCacheConfiguration {
prefix: string;
json: boolean;
timeoutInMsecs?: number;
separator?: string;
}
export declare const DEFAULT_REDIS_CACHE_CONFIGURATION: RedisCacheConfiguration;
export declare abstract class AbstractRedisCache<ConfigType extends RedisCacheConfiguration, LoadedValue> {
protected readonly redis: Redis;
protected readonly config: ConfigType;
constructor(redis: Redis, config: Partial<ConfigType>);
protected internalSet(resolvedKey: string, value: LoadedValue | null): Promise<"OK">;
protected postprocessResult(redisResult: string | null): any;
clear(): Promise<void>;
resolveKey(key: string): string;
resolveCachePattern(): string;
}