#10168 closed (wontfix)
Can't configure memcached backend to use unix socket
Reported by: | munhitsu | Owned by: | nobody |
---|---|---|---|
Component: | Core (Cache system) | Version: | 1.0 |
Severity: | Keywords: | enhancement | |
Cc: | mateusz@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
So far unix socket is the only way to apply access control on memcached daemon:
memcached -m 16 -s memcached.sock
At this point django expects memcached to be on "server:port".
Can you extend it to also support files?
settings.py:
CACHE_BACKEND = 'memcached://../memcached.sock/?timeout=' +str(TIMEOUT)+ '&max_entries=' +str(MAXENTRIES)
Exception:
File "/vhost/cr3studio/cr3studio/django_site/django/django/core/cache/backends/memcached.py", line 17, in __init__ self._cache = memcache.Client(server.split(';')) TypeError: expected "server:port" but "../memcached.sock" found
PS: you can assign it to me :)
Change History (5)
comment:1 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
follow-up: 3 comment:2 by , 16 years ago
Try:
CACHE_BACKEND = 'memcached://unix:memcached.sock'
I use:
memcached -u nobody -s /tmp/memcached.sock -a 0777
My settings.py:
CACHE_BACKEND = 'memcached://unix:/tmp/memcached.sock'
It works.
follow-up: 4 comment:3 by , 16 years ago
Replying to seifert:
Which python memcached module are you using?
comment:5 by , 16 years ago
Replying to seifert:
I use python-memcached.
In python-memcache 1.40, the setting you suggest fails with the following exception:
ValueError: invalid literal for int() with base 10: '/tmp/memcached.sock'
However, it does work with python-memcache 1.43, the latest at this time.
Since python-memcache consists of but one file, memcache.py, I suggest that you ship the appropriate version of this file as part of your site's code, with the sys.path properly set so that it's your shipped version that gets imported by Django rather than that of the system.
The resolution of this ticket requires no code change in Django, but the documentation should probably be updated to mention this possibility. What do you think, Django people?
Third party issue: cmemcache.
In fact python-memcached seems to be also affected.
Still testing.