Redis : expiration on sorted set

2,628 views
Skip to first unread message

Wahyd Mnémoi

unread,
Apr 18, 2014, 11:35:14 AM4/18/14
to redi...@googlegroups.com

Hi, sorry for my english, i'm not very fluent. About Redis, i wonder if there is a clean solution to set an expire time to a member of sorted set ?

Best regards,

tokudbfan

unread,
Apr 18, 2014, 12:35:45 PM4/18/14
to redi...@googlegroups.com
You can't do that. But if you insert a current timestamp as your score and the rest of your values as your key, you can call ZREMRANGEBYSCORE periodically to delete members based on the score. You can do something like this with LUA:

    call.redis("ZREMRANGEBYSCORE", "my:list", 0,  os.time()-ARGV[1])



Then set ARGV[1] to the number of seconds till something expires.



Wahyd Mnémoi wrote:

Hi, sorry for my english, i'm not very fluent. About Redis, i wonder if there is a clean solution to set an expire time to a member of sorted set ?

Best regards,
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Itamar Haber

unread,
Apr 18, 2014, 11:53:00 AM4/18/14
to redi...@googlegroups.com
Hi Wahyd,

Regrettably, no - expiry can only be set for keys. Perhaps someone from the forum will be able to help to solve the problem you are facing if you provide more details on what you're trying to achieve.

Cheers,
Itamar


On Fri, Apr 18, 2014 at 6:35 PM, Wahyd Mnémoi <mnemoi...@gmail.com> wrote:

Hi, sorry for my english, i'm not very fluent. About Redis, i wonder if there is a clean solution to set an expire time to a member of sorted set ?

Best regards,

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.



--
Itamar Haber
Chief Developers Advocate
Mobile (IL): +972 (54) 567-9692
Skype: itamar.haber
Blog  |  Twitter  |  LinkedIn

Wahyd Mnémoi

unread,
Apr 24, 2014, 8:52:10 AM4/24/14
to redi...@googlegroups.com
Okay 
Thank you for your answer

Cheers,
Wahyd

Wahyd Mnémoi

unread,
Apr 24, 2014, 8:52:53 AM4/24/14
to redi...@googlegroups.com, toku...@safe-mail.net
Thanks, i'll try

Cheers,
Wahyd
Reply all
Reply to author
Forward
0 new messages