I'm seeking something like a BLPUSH
command that will block until the length of a list drops below a specified max_size
. The purpose is to prevent the list from growing indefinitely if the producer runs faster than the consumer.
The functionality will be very similar to python's Queue.put()
.
Note that this accepted answer does not work, because (1) the code returns immediately, which is not blocking at all. (2) if I write a spin lock in Lua, it will freeze up Redis.
Is there a way to implement BLPUSH
in Lua, or does it have to be in C?