PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, November 12, 2022

[FIXED] How are concurrent updates handled in Memcached?

 November 12, 2022     concurrency, consistency, memcached, updates     No comments   

Issue

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?


Solution

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.



Answered By - Jack
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing