开发者

django using memcached cache backend — am I doing it right?

开发者 https://www.devze.com 2023-04-04 15:16 出处:网络
I am changing my backend cache strategy from filesystem to Memcached! My question is am I doing all steps right?

I am changing my backend cache strategy from filesystem to Memcached! My question is am I doing all steps right?

  1. Installed memcached: apt-get install memcached
  2. Installed python-memcached: pip install python-memcached
  3. Changed my CACHES variable in the settings to this:

    CACHE开发者_StackOverflow社区S = {
        'default': {
            'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
            'LOCATION': '127.0.0.1:11211',
        }
    }
    

It is just those three steps?! Or am I missing something?

Also, do I need to start the memcached server, or will Django start it automatically?

Thanks.


Django does not manage start itself memcached or other services, you have to run memcached yourself.

I always try to connect to memcached myself to see if it's up and running (and accepting connections as well) using:

telnet 127.0.0.1 11211

0

精彩评论

暂无评论...
验证码 换一张
取 消