SADD & EXPIRE Interaction

5,332 views
Skip to first unread message

Jason J. W. Williams

unread,
Oct 20, 2010, 11:57:40 PM10/20/10
to redi...@googlegroups.com
When running SADD followed by EXPIRE, all members in the set before
the SADD seem to be expunged:

redis> SADD test 1
(integer) 1
redis> SADD test 2
(integer) 1
redis> SMEMBERS test
1. "1"
2. "2"
redis> EXPIRE test 1000
(integer) 1
redis> SMEMBERS test
1. "1"
2. "2"
redis> SADD test 3
(integer) 1
redis> EXPIRE test 1000
(integer) 1
redis> SMEMBERS test
1. "3"


Since adding a member to the set will remove the expiration, how can I
re-apply the expiration to the key without losing the previous members
of the set?

-J

Jason J. W. Williams

unread,
Oct 21, 2010, 12:02:01 AM10/21/10
to redi...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages