问题:我无法memcached收听,无法与 DjangoUDP一起工作( )。get set delete
正如我在上一个问题UDP 11211中提到的那样,我只让 memcached 监听。到目前为止我已经尝试过:
1.CACHES设置使用python-memcachedPython绑定。get 和 set 不适用于简单的设置 ie 'LOCATION': '127.0.0.1:11211',因此尝试udp明确指定(使用此提及作为理由):
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': 'udp:127.0.0.1:11211',
'TIMEOUT': None,
}
}
给了:
ValueError: Unable to parse connection string: "udp:localhost:11211"
2.设置CACHES使用pylibmcPython绑定:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
'LOCATION': 'udp:127.0.0.1:11211',
'TIMEOUT': None,
}
}
服务器运行良好 - 进一步验证:
>>> import django
>>> from django.core.cache import cache
>>> cache.set('udp_key', 12)
>>> cache.get('udp_key')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/django/core/cache/backends/memcached.py", line 84, in get
val = self._cache.get(key)
NotSupportedError: error 28 from memcached_get(:1:udp_key): ACTION NOT SUPPORTED
PS不要在TCPvsUDP辩论中让它成为 memcached
一个类似的问题 - get() set() memcached 使用 Python 监听 UDP