@sophons/redis
Version:
🏡 Encapsulate common business methods for Redis
36 lines (35 loc) • 1.26 kB
TypeScript
import { Cluster, ClusterNode, ClusterOptions, PublishOptions, CacheOptions, HashCacheOptions } from './common';
/**
* Here you will use the lazy singleton pattern to create an class instance and wrap the methods for the instance
*/
export declare class SuperRedisCluster {
/**
* Core members of the lazy singleton pattern
*/
client: Cluster;
private static superRedisCluster;
/**
* Singleton constructor
*/
private constructor();
/**
* Singleton instantiation
*/
static init(nodes: ClusterNode[], options?: ClusterOptions): SuperRedisCluster;
/**
* A message is published to the specified channel
*/
publish(options?: PublishOptions): Promise<void>;
/**
* Passing in the function to be executed caches the result of the function's execution according to the configuration information
*/
cache(next: Function, 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(next: Function, options: HashCacheOptions): {
with: (...args: any[]) => Promise<any>;
};
}