@sophons/redis
Version:
🏡 Encapsulate common business methods for Redis
28 lines (27 loc) • 1.04 kB
TypeScript
import { Redis, RedisOptions, PublishOptions, MutexOptions, CacheOptions, HashCacheOptions } from './common';
export declare class SuperRedis {
readonly client: Redis;
constructor(options: RedisOptions);
/**
* A message is published to the specified channel
*/
publish(options: PublishOptions): Promise<void>;
/**
* Passing in the function to be executed will add a mutex to the function execution process
*/
mutex(options: MutexOptions): {
with: (...args: any[]) => Promise<any>;
};
/**
* Passing in the function to be executed caches the result of the function's execution according to the configuration information
*/
cache(options: CacheOptions): {
with: (...args: any[]) => Promise<any>;
};
/**
* Passing in the function to be executed caches the result of the function execution into the hash structure with configuration information
*/
hashCache(options: HashCacheOptions): {
with: (...args: any[]) => Promise<any>;
};
}