You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1.4 KiB

layout status published title author author_login author_email wordpress_id wordpress_url date date_gmt categories tags
post publish true Django and Memcached [{display_name sipp11} {login sipp11} {email sipp11@gmail.com} {url }] sipp11 sipp11@gmail.com 889 http://blog.10ninox.com/?p=889 2014-01-23 02:20:24 +0700 2014-01-22 19:20:24 +0700 [coding] [python django memcached]

Apparently it seems that both Django and Memcached work together flawlessly, but it fails silently most of the time which is hard to debug. One thing I've learned is never cache any queryset with Memcached since it wouldn't complain anything but doesn't do anything either. If you like to cache queryset, then using LoMemCache, FileBasedCache, DummyCache or whatever which is not Memcached. Everything will be all good.

Otherwise, you can separate cache into couple things then push queryset to one which is not Memcached.

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '127.0.0.1:11211'
    },
    'queryset': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
    },
}

Then you can using get_cache to pick whatever you want

from django.core.cache import get_cache, cache
mycache = get_cache('queryset')

While cache will still point to 'default' or Memcached one.