benluteijn / redis

Automatically exported from code.google.com/p/redis
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

[Feature Request] Block semantics #129

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'd like to propose block semantics, which just hit my head.

Basically:

>>> BLOCK         # want to send block of commands
GET foo
LPOP bar
SET zar ...
<<< [answers]

which is similar to earlier proposed LOCK key with implicit unlock. What 
this thing does is, basically, executes 3 commands of a single client in a 
row. Since Redis is not threaded, those commands would be guaranteed to 
execute atomically for all clients.

For single client it is equal to just sending 3 commands, because there is 
no one to interfere.

Where it could be useful:
- LPUSH/LPOP to/from several lists at once
- a replacement for MSET
- atomically replace first/last element in a list via
    BLOCK
    LPOP listkey
    LPUSH listkey [newdata]

Would be glad to hear your comments.

Sergey Shepelev.

Original issue reported on code.google.com by temotor on 21 Dec 2009 at 6:35

GoogleCodeExporter commented 9 years ago
Something like this?
http://groups.google.com/group/redis-db/browse_thread/thread/41dc7653d9c15e75

Original comment by biruk...@gmail.com on 21 Dec 2009 at 8:44

GoogleCodeExporter commented 9 years ago
Yes, block is a poor-man transaction. One without rollback.

Original comment by temotor on 21 Dec 2009 at 9:01

GoogleCodeExporter commented 9 years ago
we have this, it's called MULTI/EXEC

Cheers,
Salvatore

Original comment by anti...@gmail.com on 24 Aug 2010 at 8:03