Skip to content Skip to sidebar Skip to footer

Why Doesn't Memcache Work In My Django?

from django.core.cache import cache def testcache(): cache.set('test','I am putting this message in',3333) print cache.get('test') It just prints 'None' This i

Solution 1:

You can insure that you can reach memcached from your code by logging value returned from set() method. Probably memcached listens on 127.0.0.1 while you are trying to connect to external interface.

Solution 2:

Solved.

Django was talking to the server. I did "nc IPADRESS 11211" . And typed "stats"

Then, I looked that cmd_get and cmd_set were changing, so that means it's talking.

Then, I realized that I had problem with code in my views. You can't have "space" in the key. It has to be non-spaceless (and encoded)

Post a Comment for "Why Doesn't Memcache Work In My Django?"