Is Memcached get and put methods are thread safe

2019-04-13 04:24发布

Is there any chance of getting a garbled value for a key in memcached in multi thread environment?. If so how to avoid it with minimal time of synchronization?.

Using Java client to access memcached server

1条回答
Deceive 欺骗
2楼-- · 2019-04-13 04:46

No. Memcache will return a value that somebody wrote previously, and not a garbled value. If you get/modify/put you have no guarantee that the put applies to the same value as the get. Use the cas (compare and set) operation if you need to synchronize.

查看更多
登录 后发表回答