-
Notifications
You must be signed in to change notification settings - Fork 23.5k
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
[NEW] Add command to create empty list key which will not be deleted automaticly when it is empty #7941
Comments
Streams will soon support this with the nomkstream option. Can you see if you could use that to solve your use case? I'm a little hesitant to say that lists should support this, since it breaks a major assumption about redis data structures, in that empty keys == empty collections. Can you explain a bit more for why you don't want the servers pushing data onto the list if the client isn't listening? It sort of seems like you should always be using rpush. |
@madolson the problem is, the server can't known the leave of the client, server is always push data to that list and the list will take more and more memory so the code has to be but if the list will not delete it self when it is empty, the code become this is a normal architecture can be used on game,on live stream,on chat room... if empty list will delete it self, and server use rpush to push data: |
The problem/use-case that the feature addresses
use list like a message queue.
consumer create empty list and blpop block on it,and cyclely update it's expire time
publisher use rpushx to add data
publisher can notice the end of this message queue by the rpushx's result,and the push event can stop
scene:
there are one client and one hundred servers
one client blpop on one list,all server rpushx into the list
if the empty list will deleted automaticly,all servers have to use rpush,and servers will not get the leave event of the client
if the empty list will not deleted automaticly,all servers can get the leave event of the client by rpushx,and can stop self
Description of the feature
add command to create a list which will not deleted automaticly when it is empty.
use this new list which will not be deleted automaticly when it is empty to work with lpushx/rpushx
let user to control the list's life
maybe add a field into the quicklist struct as a marker can solve this problem?
The text was updated successfully, but these errors were encountered: