>
> Here are a couple of example projects for info.
>
> Django:
>
> http://docs.djangoproject.com/en/dev/topics/cache/
>
> It says of "increment/decrement": "incr()/decr() methods are not
> guaranteed to be atomic. On those backends that support atomic
> increment/decrement (most notably, the memcached backend), increment
> and decrement operations will be atomic. However, if the backend
> doesn't natively provide an increment/decrement operation, it will be
> implemented using a two-step retrieve/update."
>
> add() is implied to be atomic.
>
> Django itself does use add() in exactly one line of code that I can
> find. I believe it is just an optimization (don't bother saving this
> object if it already exists) and is not semantically meaningful. In
> fact, I don't believe that there is a code path to the add() call but
> I'm really not investigating very deeply.
>

FWIW, I added the atomic increment/decrement operations to the Django cache
interface (and wrote that documentation) because the functionality was
useful for large scale apps. I didn't implement atomic increment/decrement
or atomic add for backends that didn't natively support it because, in my
opinion (and in the opinion of the other Django contributors) any site that
requires that sort of functionality should be running memcached as their
cache backend. So I guess what I'm saying is that the functionality _is_
useful. However, there probably are some users who would find the subset of
the memcache protocol that you _can_ implement on top of Cassandra useful.

Meh.

Mike

Reply via email to