I want to save a set of indefinite length in redis, and the whole set should expire in a few minutes.
So I do:
RPUSH 'a' 'b'
EXPIRE 'a' 120
RPUSH 'a' 'c'
EXPIRE 'a' 120
but in this case I only have 'c' in 'a', because the first RPUSH after EXPIRE processes the old value.
Install EXPIRE first, we have TTL β - 1 after the first RPUSH.
So my question is, is there a way to do what I want?
source share