ioredis: Add some missing properties (#10240)

These are minor changes:

* There's a `status` field that can be used to check if the connection to the redis server is active.
* There's a `getBuffer` method that returns a node `Buffer` instance instead of a string (if you're saving binary data on redis, this is useful).
* The callback on `connect` is optional.
This commit is contained in:
Esteban Ordano
2016-07-23 22:59:38 -07:00
committed by Mohamed Hegazy
parent 10f5180288
commit 994439d8ed
+3 -1
View File
@@ -41,7 +41,8 @@ declare module IORedis {
}
interface Redis extends NodeJS.EventEmitter, Commander {
connect(callback: Function): Promise<any>;
status: string;
connect(callback?: Function): Promise<any>;
disconnect(): void;
duplicate(): Redis;
monitor(calback: (error: Error, monitor: NodeJS.EventEmitter) => void): Promise<NodeJS.EventEmitter>;
@@ -59,6 +60,7 @@ declare module IORedis {
subscribe(channel: string): any;
get(args: any[], callback?: ResCallbackT<string>): any;
get(...args: any[]): any;
getBuffer(key: string, callback?: ResCallbackT<Buffer>): any;
set(args: any[], callback?: ResCallbackT<string>): any;
set(...args: any[]): any;
setnx(args: any[], callback?: ResCallbackT<any>): any;