node-cache-manager-redis-store icon indicating copy to clipboard operation
node-cache-manager-redis-store copied to clipboard

RedisStore does not extend correctly Store

Open charles-dexter-ward opened this issue 3 years ago • 1 comments

It seems the definition of RedisStore at

https://github.com/dabroek/node-cache-manager-redis-store/blob/master/dist/index.d.ts

is not compatible with the definition of Store at

https://github.com/node-cache-manager/node-cache-manager/blob/master/src/caching.ts

the methods set(), get(), keys(), reset() and ttl() have an incompatible function definitions

interface RedisStore extends Store {
    name: string;
    getClient: () => RedisClientType;
    isCacheableValue: any;
    set: (key: any, value: any, options: any, cb: any) => Promise<any>;
    get: (key: any, options: any, cb: any) => Promise<any>;
    del: (...args: any[]) => Promise<any>;
    mset: (...args: any[]) => Promise<any>;
    mget: (...args: any[]) => Promise<any>;
    mdel: (...args: any[]) => Promise<any>;
    reset: (cb: any) => Promise<any>;
    keys: (pattern: string, cb: any) => Promise<any>;
    ttl: (key: any, cb: any) => Promise<any>;
}
export type Store = {
  get<T>(key: string): Promise<T | undefined>;
  set<T>(key: string, data: T, ttl?: Ttl): Promise<void>;
  del(key: string): Promise<void>;
  reset(): Promise<void>;
  mset(args: [string, unknown][], ttl?: Ttl): Promise<void>;
  mget(...args: string[]): Promise<unknown[]>;
  mdel(...args: string[]): Promise<void>;
  keys(pattern?: string): Promise<string[]>;
  ttl(key: string): Promise<number>;
};

charles-dexter-ward avatar Oct 21 '22 14:10 charles-dexter-ward

Any updates?

slaveofcode avatar Nov 10 '22 16:11 slaveofcode