append, prepend, cas
dustin at spy.net
Wed Nov 7 01:04:07 UTC 2007
On Nov 6, 2007, at 9:03 , Brian Aker wrote:
> In the scenario where I am just wanting to update a block of data I
> may not know the value of the flags or exptime. Right now the only
> way I see to do these operations safely, though not atomically, is
> to fetch these values before inserting.
> This issue is not addressed in the protocols document, so I wanted
> to know how these operators were thought out. I would think it would
> make more sense to have these operators extend and modify without
> having too specifying these arguments (and possibly add an update
> method to modify exptime and flags).
CAS is a bit different, I think. You can't possibly do it without
doing a gets first because you need to know the compare value before a
save can be successful.
The whole purpose of CAS is updating an exact server-side value. In
order to do that, you have to prove that you know what the exact value
is. If anything modifies it between your gets and your set, the CAS
*must* fail and you'll have to retry from gets again.
More information about the memcached