export interface CacheSetOptions { /** * in milliseconds */ ttl?: number; } // extends if needed export interface Cache { // standard operation get(key: string): Promise; set( key: string, value: T, opts?: CacheSetOptions ): Promise; setnx( key: string, value: T, opts?: CacheSetOptions ): Promise; increase(key: string, count?: number): Promise; decrease(key: string, count?: number): Promise; delete(key: string): Promise; has(key: string): Promise; ttl(key: string): Promise; expire(key: string, ttl: number): Promise; // list operations pushBack(key: string, ...values: T[]): Promise; pushFront(key: string, ...values: T[]): Promise; len(key: string): Promise; list(key: string, start: number, end: number): Promise; popFront(key: string, count?: number): Promise; popBack(key: string, count?: number): Promise; // map operations mapSet( map: string, key: string, value: T, opts: CacheSetOptions ): Promise; mapIncrease(map: string, key: string, count?: number): Promise; mapDecrease(map: string, key: string, count?: number): Promise; mapGet(map: string, key: string): Promise; mapDelete(map: string, key: string): Promise; mapKeys(map: string): Promise; mapRandomKey(map: string): Promise; mapLen(map: string): Promise; }