@onesy/redis
Version:
46 lines (45 loc) • 1.74 kB
TypeScript
import redis from 'redis';
import OnesySubscription from '@onesy/subscription';
export interface IMessageDataOptions {
parse?: boolean;
}
export interface IOptions {
uri?: string;
namespace?: string;
}
export declare const optionsDefault: IOptions;
export type IRedisClient = redis.RedisClientType<redis.RedisDefaultModules, any, any>;
declare class OnesyRedis {
client_: IRedisClient;
clientSubscriber: IRedisClient;
connected: boolean;
namespace: string;
private amalog;
private options_;
subscription: OnesySubscription<any>;
get options(): IOptions;
set options(options: IOptions);
constructor(options?: IOptions);
query(queryProps?: string): Promise<string[]>;
get(keyProps: string, options?: {
parse: boolean;
}): Promise<any>;
add(keyProps: string, value: any): Promise<any>;
set: (keyProps: string, value: any) => Promise<any>;
remove(keyProps: string): Promise<any>;
delete: (keyProps: string) => Promise<any>;
removeMany(query?: string): Promise<any>;
deleteMany: (query?: string) => Promise<any>;
subscribe(channels: string | string[], method: (message: string) => any, bufferMode?: boolean): Promise<void>;
unsubscribe(channels: string | string[], method: (message: string) => any, bufferMode?: boolean): Promise<void>;
messageData(message: string, options?: IMessageDataOptions): any;
publish(channel: string, data?: any, options?: {
serialize: boolean;
}): Promise<any>;
get client(): Promise<IRedisClient>;
get connection(): Promise<IRedisClient>;
get disconnect(): Promise<void>;
connect(): Promise<IRedisClient | undefined>;
reset(): Promise<any>;
}
export default OnesyRedis;