为django项目安装memcached

Mat*_*lla 40 linux django memcached caching

来自django文档:

安装Memcached本身后,您需要安装memcached绑定.有几个python memcached绑定可用; 最常见的两个是python-memcached和pylibmc.

pylibmc文档有自己的要求:

-libmemcached 0.32 or later (last test with 0.51)
-zlib (required for compression support)
-libsasl2 (required for authentication support)
Run Code Online (Sandbox Code Playgroud)

所以在我看来,我需要做以下事情:

-install memcached
-install libmemcached
-install zlib
-install libsas12
-install pylibmc
Run Code Online (Sandbox Code Playgroud)

我如何/在哪里这样做?我已经习惯了只需要安装我需要的东西,但我甚至无法分辨哪些是python包.这些是捆绑在一起的吗?

Mat*_*son 88

只是做pip install python-memcached,你应该是好的.

至于安装memcached本身,它取决于你所在的平台.

在OS X/Linux上,只需memcached在命令行中运行即可.

  • 继续添加`sudo apt-get install libmemcached-tools`,这样你就可以使用**memcstat**来告诉memcached的状态.即`$ watch -n1 -d'memcstat --servers localhost` (7认同)

Ili*_*iev 23

详细解释见http://ilian.ini.org/caching-websites-with-django-and-memcached/

上面的链接包括如何在Ubuntu上安装Memcached的解释,如何在Django项目中将其配置为缓存引擎以及如何使用它.