The FAQ outlines a method of reducing the effects of clobbering
updates, by use of an embedded expiration value.

http://code.google.com/p/memcached/wiki/FAQ#How_to_prevent_clobbering_updates,_stampeding_requests

"Then, when you get from the cache and examine the timeout and find it
expired, immediately edit the embedded timeout to a time in the future
and re-store the data as is."

If a CAS operation is used here, wouldn't it prevent others from doing
unnecessary work?

If the CAS operation succeeds, then its the currently running tasks
responsibility to refresh the data in the cache, if it fails with
RES_DATA_EXISTS, then someone else is taking care of the update.

Jared




Reply via email to