Skip to content

save method is resetting existing expire value in case of update #236

@vhochstein

Description

@vhochstein

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,
    }
);

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions