有了memcached做緩存,django的速度就像飛起來了
安裝
sudo apt-get install memcached
pip install python-memcached
sudo apt-get install python-dev
sudo apt-get install libmemcached-dev
pip install pylibmc
配置
CACHES = {
'default': {
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
'LOCATION': 'localhost:11211',
'TIMEOUT': 500,
'BINARY': True,
'OPTIONS': { # Maps to pylibmc "behaviors"
'tcp_nodelay': True,
'ketama': True
}
}
}
檢視memcached狀态
echo stats | nc 127.0.0.1 11211|grep get