I'm using Redis 3.0.2 in node.js app.
Iv'e added hset and then I set 'expire' command
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);
}
}
The expire has worked for the first time, after a second I expired again and it doesn't work.
I expect that a key that already has an existing expiration set. In this case the time to live of a key is updated to the new value but the key has removed by redis even the function return true.
Refreshing expires - https://redis.io/commands/expire
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…