I'd like the ability to expire members of a set instead of the whole set.
The patterns described here http://groups.google.com/group/redis-db/browse_thread/thread/ad75cc08b364352b are not really feasable to me.
Comment From: antirez
Hello, unfortunately it is not in our plans! Sorry.
The one sentence rationale is: too complex, too memory consuming, more CPU needed. In general the Redis model is: at level of key, many features: timeout, migration, sharding (Redis Cluster). At value level no fancy stuff.
Comment From: pietern
This is not going to be added. There is a lot of extra memory involved, not to mention a lot of processing to make sure the elements would in fact be expired. The best way to implement this is to model this yourself, so you can stick to the bare minimum you need, while keeping all the flexibility to change things as you please.
The best pattern to model this is, in my opinion, using sorted sets with a score equal to the timestamp the member should expire. You can use ZRANGEBYSCORE <now> +inf to retrieve all elements that are not yet expired, and ZREMRANGEBYSCORE to expire items. Since a sorted set is also backed by a hash table, you retain O(1) TTL lookup.
Good luck.
Comment From: bobrik
+1 for sorted sets for this task. We use that for millions of integers in sorted set and it's ok
Comment From: xxxcoltxxx
+1
Comment From: dmitrypol
+1 would be a great feature (but obviously comes with a cost)
Comment From: bradvogel
+1
Comment From: duke-cliff
+1 It should be added. Memory is a give&take the user should consider. If we need the feature indeed, we will take the result of using more memory for sure.
Comment From: lukepighetti
What about tying a command to an EXPIRE? That way we can expire keys but trigger the deletion of a specific member of a set?
Comment From: inoas
+1
Comment From: Nijasbijilyrawther
+1, Expiry time for Redis set members will be highly appreciated.
Comment From: jsbg
This should be added. Obviously there is more memory and computation involved. But without this, everyone who needs this will need more memory and computation AND the developer time to implement the same sorted set solution.
Comment From: jawadcode
+1 It would be nice if this feature were added because then someone can decide whether or not to use it, it would probably end up being slower if a dev implemented this themselves anyways.
Comment From: seqwait
This should be added. Obviously there is more memory and computation involved. But without this, everyone who needs this will need more memory and computation AND the developer time to implement the same sorted set solution.
Comment From: drachs
It is really unfortunate that this common requirement has to be re-implemented by each developer each time. I think Redis would be better off with this feature.
Comment From: liranco4
+1
Comment From: dada8397
+1
Comment From: Elya2305
+1
Comment From: pfk84
+1
Comment From: alevalentz
+1
Comment From: vivekshiva444
+1
Comment From: llawwaii
+1
Comment From: tianjos
+1
Comment From: samtech09
+1
Comment From: CaffeineDuck
+1
Comment From: andreav
+1
Comment From: nRewik
+1
Comment From: SerajMuftah
+1
Comment From: jmb-tc
+1
Comment From: agtoledo
+1
Comment From: phuyha
+1
Comment From: Rush
I created a module to achieve this https://github.com/Rush/redis_expiremember_module
- Built in Rust
- Strives for a minimal performance footprint
It's not as good as a native implementation would be, but we use it with success