calling SET removes the TTL of a record
See original GitHub issueI am not sure if this is intentional, if there is a way to change it but the document of ioredis just sucks or is something not really possible with this module.
I created some record like
await client.setex('key1', 'hello', 10);
const x = await client.ttl('key1')
// x = 10
when the code is changed to the following
await client.setex('key1', 'hello', 10);
await client.set('key1', 'world');
const x = await client.ttl('key1')
// x = -1
just running a set command automatically removes TTL. Now I have tried looking at the types (d.ts) file for anything that I can use and there appears to be something called an “expiryMode” parameter in the set command. looking at possible values for this and wow… ioredis docs denies its existence. It has no default and enumerated values, not even docummented. so what is that for? what I am doing btw is try to update the record without altering the existing TTL value
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
What is DNS TTL + Best Practices - Varonis
DNS TTL (time to live) is a setting that tells the DNS resolver how long to cache a query before requesting a new...
Read more >What is TTL? - ClouDNS
TTL for NXDOMAIN responses is set from the minimum of the MINIMUM field of the SOA record and the TTL of the SOA...
Read more >How can I update a redis value without affecting the remaining ...
According to Redis documentation, the SET command removes the TTL because the key is overwritten. However you can use the EVAL command to ......
Read more >Cassandra TTL intricacies and usage by examples - Medium
It would delete the record after set time after the value in that field. So obviously that field should be of type date...
Read more >What Is The Lowest TTL I Can Get Away With? - NS1
While there is a sort of unspoken belief that setting a low TTL for a record will result in users getting sent to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ugh! nevermind! you guys should use enums for this on your Typescript…
EX seconds – Set the specified expire time, in seconds. PX milliseconds – Set the specified expire time, in milliseconds. NX – Only set the key if it does not already exist. XX – Only set the key if it already exist. KEEPTTL – Retain the time to live associated with the key
ah got it! thanks