本文整理汇总了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);
});
});