Over here at the Django groups Tom Evans explains the method to do compare and set in Django as shown below
You can access the memcached client via django though:
>>> from django.core import cache
>>> c=cache.get_cache('default')
>>> help(c._client.cas)
But somehow I couldn’t get it to work.
>>> from django.core import cache
>>> c=cache.get_cache('memcache')
>>> help(c._client.cas)
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'MemcachedCache' object has no attribute '_client'
How can I get to do a compare and set in Django, if not the method shown above?
I use Django version 1.3.
after looking at the source code! i find this at BaseMemcachedCache:
So, I would say that, this will work:
Try, and let me know!
for more details: https://code.djangoproject.com/svn/django/trunk/django/core/cache/backends/memcached.py