本文整理匯總了TypeScript中redis.RedisClient類的典型用法代碼示例。如果您正苦於以下問題:TypeScript RedisClient類的具體用法?TypeScript RedisClient怎麽用?TypeScript RedisClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了RedisClient類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Promise
return new Promise((resolve: (val: string) => void, reject: (val: string) => void) => {
const cacheKey: string = [this.getPrefix(), this.getHashedKey(key)].join('.');
const client: RedisClient = this.getClient();
client.get(cacheKey, (err: string, result: string) => {
if (err) {
this.disconnect();
return reject(err);
}
this.disconnect();
resolve(result);
});
});
示例2: resolver
return new Promise<Array<string>>((resolver, reject) => {
let callback: ResCallbackT<Array<string>> = (err: Error, res: Array<string>) => {
if (err) { reject(err); }
return resolver(res);
};
this.client.hkeys(regionName, callback);
});
示例3: resolve
return new Promise<void>((resolve, reject) => {
let args: any[] = ['region_stats', r.uuid, data];
this.redis.hset(args, (err: Error, reply) => {
if (err) return reject(err);
resolve();
});
});
示例4: cb
this.client.get(k, (err: any, res: String) => {
if (err) {
return cb(err);
}
this.client.del(k);
return cb(null, res);
});
示例5: resolve
return new Promise<UserDetail>((resolve, reject) => {
let args: any[] = ['session', user.UUID, JSON.stringify(detail)];
this.redis.hset(args, (err: Error, reply) => {
if (err) return reject(err);
resolve(detail);
});
});
示例6: reject
return new Promise<number>((resolver, reject) => {
return this.client.hset(regionName, key, JSON.stringify(value), (err: Error, res: number) => {
if (err) {
reject(err);
}
resolver(res);
});
});