HandlerSocket-Plugin-for-MySQL icon indicating copy to clipboard operation
HandlerSocket-Plugin-for-MySQL copied to clipboard

Atomic increment, decrement and replace operations?

Open greenlion opened this issue 13 years ago • 1 comments

I am trying to implement a drop-in replacement PHP Class for Memcache using HandlerSocket, but there are a few technical problems that I can't seem to work around without using external locking mechanisms which hurt performance.

Memcache supports atomic increment and decrement. Since HandlerSocket uses different connections for reading and writing, I can't figure out how to increment/decrement a value without a race condition.

Memcache also supports replace operations. If pipelined operations act as a transaction, then replace can be mapped to delete followed by insert, but it is unclear from the documentation if this is the case. Can you please clarify this?

Thanks.

greenlion avatar Dec 19 '10 20:12 greenlion

You can't implement atomic increment nor atomic replace ops using the current version of HandlerSocket. A bunch of pipelined requests does not act as a transaction.

ahiguti avatar Dec 20 '10 02:12 ahiguti