Reputation: 36205
I'm working with an ubuntu 16.04 VPS, where I have a django 1.8 app running using uwsgi and nginx. I want to install memcached for django , so I've been looking at https://docs.djangoproject.com/en/1.8/topics/cache/. I want to use pylibmc as my memcached client.
Based on this, I've added:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
'LOCATION': '/tmp/memcached.sock',
}
}
to my settings.py. But when I run
(myenv) deploy@server:~$ sudo systemctl status memcached
● memcached.service - memcached daemon
Loaded: loaded (/lib/systemd/system/memcached.service; enabled; vendor preset
Active: active (running) since Fri 2017-02-17 11:21:07 EST; 5s ago
Main PID: 5562 (memcached)
CGroup: /system.slice/memcached.service
└─5562 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1
Based on the output it appears that memcached is using an ip address and port (if I understand correctly) .How can I configure memcached to use the django socket backend?
Upvotes: 1
Views: 1329
Reputation: 23
Modify /etc/memcached.conf
Comment -p
and -l
- This disables TCP sockets
Add -s /tmp/memcached.sock
and restart the daemon
https://linux.die.net/man/1/memcached
Upvotes: 2