@acuris/leprechaun-cache
Version:
Caching library that supports double checked caching and stale returns to avoid stampede and slow responses
12 lines (11 loc) • 550 B
TypeScript
import { CacheStore, CacheItem, Cacheable } from '../types';
import { RedisClient } from 'redis';
export declare class RedisCacheStore<T extends Cacheable = Cacheable> implements CacheStore<T> {
private redisClient;
constructor(redisClient: RedisClient);
get(key: string): Promise<CacheItem<T> | null>;
set(key: string, data: CacheItem<T>, ttl: number): Promise<boolean>;
del(key: string): Promise<boolean>;
lock(key: string, ttl: number): Promise<string | false>;
unlock(key: string, lockId: string): Promise<boolean>;
}