如何在Memcached中处理并发更新? [英] How are concurrent updates handled in Memcached?
问题描述
Memcached如何处理对象的多个版本?只是取最后更新完成的那个,并从缓存中驱逐其他版本?数据库是否主动使在Memcached服务器上缓存的对象无效?
Memcached只保存对象的最后一个版本。如果你得到,修改并且你不能保证put应用与get相同的值。如果需要同步,可以使用CAS操作(获取
, cas
)。
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?
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.
这篇关于如何在Memcached中处理并发更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!