layered-loader
Version:
Data loader with support for caching and fallback data sources
21 lines (20 loc) • 1.04 kB
TypeScript
import type Redis from 'ioredis';
import { Loader } from '../Loader';
import type { Cache, CacheEntry } from '../types/DataSources';
import type { GetManyResult } from '../types/SyncDataSources';
import type { RedisCacheConfiguration } from './AbstractRedisCache';
import { AbstractRedisCache } from './AbstractRedisCache';
export declare class RedisCache<T> extends AbstractRedisCache<RedisCacheConfiguration, T> implements Cache<T> {
readonly expirationTimeLoadingOperation: Loader<number>;
ttlLeftBeforeRefreshInMsecs?: number;
name: string;
constructor(redis: Redis, config?: Partial<RedisCacheConfiguration>);
delete(key: string): Promise<unknown>;
deleteMany(keys: string[]): Promise<unknown>;
get(key: string): Promise<T | undefined>;
getMany(keys: string[]): Promise<GetManyResult<T>>;
getExpirationTime(key: string): Promise<number | undefined>;
set(key: string, value: T | null): Promise<void>;
setMany(entries: readonly CacheEntry<T>[]): Promise<unknown>;
close(): Promise<void>;
}