Noob question about how to avoid overwriting cache values

Lei Jin j_l_lei at yahoo.com
Thu Jul 5 08:12:52 UTC 2007


Hello, Memcached experts:

   I have a question about how to maintain data
integrity if two machines both write to a data field
stored in memcache.  Basically, I have a value that
records user activity scores.  Periodically, machine A
and machine B will update that value based on the
previous value and the activity of the user on the
respective machine during this period.  If machine A
and B do this in order, then everything is fine.  But
the problem happens if A and B do it at about the same
time, so both are working off of the original value. 
In that case, one machine will override the change
made by the other machine.  In DB transactions, this
obviously is not a problem, but my question is, how do
I prevent this from happening when I'm dealing with a
cache?  Thanks in advance.  


       
____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC


More information about the memcached mailing list