2 ms·
MULTI/EXEC is completely atomic and transactional. You can perform just writes inside the block. If you want atomicity with reads in the middle, you need to us
by antirez 16y ago
MULTI/EXEC is completely atomic and transactional.
You can perform just writes inside the block. If you want atomicity with reads in the middle, you need to use WATCH/MULTI/EXEC that uses an optimistic locking algorithm.
- IgorPartola 16y agoAh, that makes sense. I imagine allowing atomic reads without WATCH would complicate the code quite a bit.
- antirez 16y agoIndeed, not very Redis-ish :) With WATCH is very easy. WATCH this keys. Perform your reads. Prepare to write in a transaction. If at least one key was modified in the meantime the transaction will fail.
- x09 16y agoSalvatore, you do realize that now you need to put a Klashnikov on the new Redis logo? :p