问题描述
我在 node.js 应用程序中使用 Redis 3.0.2。 我添加了 hset 然后我设置了 'expire' 命令
async function updatePublisherTtl(publisherId,publisherSockets) {
const logger = $log.child({method: 'updatePublisherTtl'});
const publisherKey = `${LIVETAIL_REdis_PREFIX}:${LOGS_BULK_PREFIX}:${publisherId}`;
const publisherTtl = await redisClient.expire(publisherKey,5);
console.log(publisherTtl);
if (!publisherTtl) {
publisherSockets.forEach(function(socket) {
socket.server.close();
});
logger.error("Failed to set TTL for publisher: {},closing immediately the entire sockets for this Livetail publisher",publisherId);
}
}
过期第一次有效,一秒钟后我再次过期,但它不起作用。 我希望已经有一个现有的到期集的密钥。在这种情况下,键的生存时间更新为新值,但即使函数返回 true,键也已被 redis 删除。
刷新过期 - https://redis.io/commands/expire
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)