管理器问题"/>
NestJs 缓存管理器问题
我在尝试使用 NestJS 的缓存管理器时遇到了问题, 问题是值总是返回
true
,
const isSet = await this.cacheManager.store.getClient().set(key, value, 'EX', ttl, 'NX')
console.log("isSet => " + lockExists)
if(lockExists === true) {
try {
//do smth
} catch(err) {
console.log("err => " + err)
throw err;
} finally {
//await this.cacheManager.del(key);
}
}
我的问题是,当我重复使用 redis-cli 时
set key val ex ttl nx
不存在则返回OK,存在则返回nil。
为什么缓存管理器一直返回 true?
依赖版本
"cache-manager": "^3.6.0",
"cache-manager-redis-store": "^2.0.0",
回答如下:
更多推荐
NestJs 缓存管理器问题
发布评论