[EXPIRE] What is the maximum of expire value
Hello, i want to set maximum of ttl using expire command.
So, i want to know what is the maximum of value can pass to expire command.
I know the command PERSIST can make no expire.
But i have personal reason to use expire command not a PERSIST.
I'm using redis 3.2.10
Hello @stories2
It depends.
EXPIRE will accept as a maximum TTL value the number of seconds remaining until some time in the year 2038.
If you were to run it on Jan 1st, 1970 at 00:00:00Z, you could have used the value of 9223372036854775 seconds as a maximum. Because time keeps moving, using EXPIRE for that is hard.
Instead, consider using EXPIREAT and the the value of 9223372036854775 to set the TTL to the max.
@itamarhaber Then i have one more question. What is 9223372036854775?
Is it (2^63-1 millisec / 1000) => sec ?
Hi, @stories2 You're right. Actully. 1] pexpire uses miliseconds. -> https://redis.io/commands/pexpire/ 2] and It uses LLONG (Signed Value) -> so it is 2^63 - 1 (instead of 2^64 -1)
Thx everyone.