If I update an existing key, which has an expire value set using save method, afterwards expire is reset to -1.
create:
const ecareSession = await ecareSessionRepository.save(req.params.sessionid, req.body);
const ttlInSeconds = 1 * 60 * 60; // 1 hours
await ecareSessionRepository.expire(ecareSession[EntityId], ttlInSeconds);
update:
const ecareSession = await ecareSessionRepository.save(req.params.sessionid, req.body);
const key = ecareSession[EntityKeyName];
const ttl = await redisUtil.redisClient.ttl(key);
ttl is -1, expected round about 3599
const ecareSessionSchema = new Schema('ecare-session', {
data: { type: 'string' }
},
{
dataStructure: 'HASH',
idStrategy: myRedisIdGenerator,
}
);