There is a scenario where a cache gets updated by two threads like the 
instance mentioned below

 a. thread 1 looks at the memcache key and gets a miss
  b. thread 1 falls back to the database
  c. thread 2 changes the database value
  d. thread 2 updates the memcache key with the new value
  e. thread 1 sets the old database value into memcache  

I know this scenario is application specific. But the question I have is if 
possible there is an option to say the current value's timestamp is older 
than the one already in cache, then memcached should ignore the new entry. 
This could solve race condition as mentioned above. Suppose I say take the 
timestamp as the version then memcached server could make use of this to 
verify whether new entry coming is older than the already current one 
present.

Handling at the client would be performance intensive because of every time 
fetching an existing value from the cache to check the timestamp.

Are there any handlers for this to solve. Would be very helpful if you 
could provide any inputs on this.


Thanks,
Sachin


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to