How are concurrent updates handled in Memcached?

戏子无情 提交于 2019-12-10 17:22:07

问题


My understanding is that Memcached is lockless (in its default configuration), such that no client can impede any other client's operation. If that is the case, then how does Memcached handle two or more clients attempting to update the same object at the same time?

How does Memcached handle multiple versions of an object? Simply take the one whose update finished last and evict the other versions from the cache? Is the database actively invalidating objects cached on a Memcached server?


回答1:


Memcached hold only last version of object. If you get, modify and put you have no guarantee that the put applies to the same value as the get. You could use CAS operations (gets, cas) if you need to synchronize.



来源:https://stackoverflow.com/questions/16134883/how-are-concurrent-updates-handled-in-memcached

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