Is Memcached get and put methods are thread safe

自作多情 提交于 2019-12-09 23:09:28

问题


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:


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.



来源:https://stackoverflow.com/questions/6611799/is-memcached-get-and-put-methods-are-thread-safe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!