import Redis, { RedisKey, RedisOptions } from "ioredis"; interface Parser { parse: (text: string) => any; stringify: (value: any) => string; } interface CacheOptions { redis: RedisOptions | Redis; parser?: Parser; } declare type Key = RedisKey | number; declare type Map = { [id: string]: T; }; declare type Awaitable = T | Promise; declare const NOT_FOUND_VALUE: undefined; declare type CacheReturn = T | typeof NOT_FOUND_VALUE; declare class Cache { redis: Redis; protected prefix: string; protected parser: Parser; constructor(options: Redis | CacheOptions); static bindAll(target: Cache): Cache; cache(key: Key, fn: () => Awaitable, ttl?: number): Promise; getCache(key: Key): Promise>; setCache(key: Key, value: any, ttl?: number): Promise<"OK">; manyCache(keys: K[], fn: (keys: K[]) => Awaitable | T[]>, prefix?: Key, ttl?: number): Promise; getManyCache(keys: Key[]): Promise[]>; setManyCache(valueMap: { [id: string]: any; }, ttl?: number): Promise<"OK" | [error: Error | null, result: unknown][] | null>; deleteCache(...keys: Key[]): Promise; deletePattern(pattern: string, batch?: number): Promise; hashCache(key: Key, id: Key, fn: () => Awaitable): Promise; getHashCache(key: Key, id: Key): Promise>; setHashCache(key: Key, id: Key, value: any): Promise; hashManyCache(key: Key, ids: K[], fn: (ids: K[]) => Awaitable | T[]>): Promise; getHashManyCache(key: Key, ids: Key[]): Promise[]>; setHashManyCache(key: Key, valueMap: { [id: string]: any; }): Promise<"OK" | never[]>; deleteHashCache(key: Key, ...ids: Key[]): Promise; acquire(key: Key, amount: number, fn: (current: number) => Awaitable, float?: boolean): Promise; hashAcquire(key: Key, id: Key, amount: number, fn: (current: number) => Awaitable, float?: boolean): Promise; protected _buildSetParams: (valueMap: { [id: string]: any; }) => string[]; } export default Cache;