-
Notifications
You must be signed in to change notification settings - Fork 23.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Expire on hash #167
Comments
Hi, it is not possible, either use a different top-level key for that specific field, or store along with the filed another field with an expire time, fetch both, and let the application understand if it is still valid or not based on current time. |
redis 127.0.0.1:6379> hset expire:me name tom redis 127.0.0.1:6379> expire expire:me 10 ... redis 127.0.0.1:6379> ttl expire:me so it works |
I believe the request is to expire individual fields. Expiring the entire hash is the same as expiring any other key. |
Yes, I've also met this requirement. Is it possible to expire individual fields? |
Is there a specific problem with creating multiple hashes with different expiration times? |
Well, I almost never want to expire an entire hash at once. So really, you're suggesting breaking up a hash into a bunch of keys. That works, but the same argument could be used to ask why you need a hash at all? There's immense value in grouping all your logically related keys together. Otherwise, you need to do that accounting through some set that stores your keys and you run into referential integrity issues. It's all doable, but it feels like a pretty big omission in redis to not support expiring individual keys in a hash. And I'm not convinced there's any value in having N different people solve it M different ways. |
Thanks Kevin Menard & Johan Bergström. Actually I met the same scenario described here:#242, and I have read comments given by Salvatore. Regards, |
This is very problematic. The reason I want to expire specific keys inside a hash is because I'm storing cached settings in the hash. I want to expire the keys automatically after I set them. at the same time, I need to be able to kill the whole hash if all of my settings have been updated. So I need the ability to get these settings in the list, and kill the list. without finding all instance of settings:whatever. |
Have same problem with bjoshuanoah, now, i am using key with ttl instead of hash, e.g: |
Fix @see tags referencing int params that are now long
Is lack of this feature technically not possible or is it choice of design? |
The choice of design lead to an implementation that doesn't allow an implementation. |
👍 |
redis itself does not support , this function is too useful. |
Until today redis did not plan to implement this functionality :-( |
there is only one field in the hashtable, what about multiple fieleds? It would not work correly! |
@oylz - I believe that the original intent of this feature request is allowing the expiry of specific fields inside the hash, not the entire key. |
@itamarhaber ttl expire:me 10 The entire hashtable(expire:me) will be expired. |
@oylz We know complete hash will be expire. its working but here we are talking about one single field of any hash (as @itamarhaber explained you already). e.g In your case how can you expire name1 field after 5s, name2 after 10 and name 3 after 15 seconds ? I hope now its clear what use-case is under discussion here. |
@nomi-ramzan |
@nomi-ramzan redis 127.0.0.1:6379> expire expire:me 10 ... redis 127.0.0.1:6379> ttl expire:me so it works_ |
This is 2020, Redis should look in to this |
our Company has implement expire hash field function |
Providing this feature natively will be very much helpful. |
you guys can use my package support expire field/member in hash/set/sorted-set for work around |
+1 for this feature. |
you guys can try this: https://github.com/alibaba/TairHash |
+1 |
+1 |
+1, Very useful requirement this is. Please lets know if there is any latest release plan that supports it. |
+1 |
已收到
|
Yes please = ) |
This is a very nice feature, hope redis will implement it in the future |
+1 |
已收到
|
+1 |
this is still a issue, 11 years & counting |
已收到
|
+1 |
+1 for this feature |
已收到
|
+1 please |
+1 |
1 similar comment
+1 |
I'd love this +1 |
已收到
|
+1 |
I created a Redis module in Rust that implements an EXPIREMEMBER command https://github.com/Rush/redis_expiremember_module It is not as sophisticated as the implementation in KeyDB but was designed for performance. The only inconvenience is that client code should make sure to reset expirations by |
Heads up, we've started implementing hash field expiration, and it's planned for an upcoming release. |
Hello, I would like to know if it's possible to set a expire time on keys of a hash ?
For example, i would like to have the list of connected members in a hash with an expiration of 5 minutes on each key.
Is it possible?
Thanks, and sorry in advance for my english.
Regards, Max
The text was updated successfully, but these errors were encountered: