有了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