On Fri, Aug 7, 2009 at 4:37 AM, Dustin<dsalli...@gmail.com> wrote: > On Aug 6, 6:26 am, Ren <jared.willi...@ntlworld.com> wrote: >> 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. > > That's an interesting approach. I'd only fear a failure to actually > update the value causing stale data to stick around longer than you'd > like. Probably best to run those updates through your favorite job > queue.
I see this as a good idea. I think that the failure to update should be on the step where it puts back the original data with the extended expiry. If it cannot do this, then starting again will either read the stale data with extended expiry, or updated data. Either way, that thread will not update it. Can you tell it not to use CAS (i.e. force the write) when it writes the updated data with new expiry after regeneration? If so, then it's unlikely that stale data will hang around longer. David