Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
No way. Expiration can only be set for a key. But you can do the following. Instead of set, use sorted set, and in it, as score, use the timestamp of the time until which the element must exist. Next, just periodically remove all elements with a score value from 0 up to the current time. Well, when reading, make sure that the result does not include elements whose score is already less than the current timestamp.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question