Django Memcache:比较和设置
Tom Evans 在此处的 Django 群组中解释了该方法 进行比较在 Django 中设置,如下所示
You can access the memcached client via django though:
>>> from django.core import cache
>>> c=cache.get_cache('default')
>>> help(c._client.cas)
但不知何故我无法让它工作。
>>> 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'
如果不是上面显示的方法,我怎样才能在 Django 中进行比较和设置?
我使用 Django 版本 1.3。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看完源码后!我在 BaseMemcachedCache 中找到了这个:
所以,我想说,这会起作用:
尝试一下,然后让我知道!
有关更多详细信息: https://code.djangoproject .com/svn/django/trunk/django/core/cache/backends/memcached.py
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