Created
January 23, 2011 21:43
-
-
Save jcroft/792466 to your computer and use it in GitHub Desktop.
Using Django trunk with the python-memcache background, I can set the cache, but not get from it. But it's definitely setting, because you can see that the underlying memcache instance (cache._cache) is able to get -- it's just django's cache.get() method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CACHES = { | |
'default': { | |
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', | |
'LOCATION': '127.0.0.1:11211', | |
'KEY_PREFIX': 'barstar_', | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from django.core.cache import cache | |
>>> cache.clear() | |
>>> cache.get('testing_yo') | |
>>> cache.set('testing_yo', 'testing, yo!', 300) | |
>>> cache.key_prefix | |
'barstar_' | |
>>> | |
>>> # Using Django's cache framework's get method | |
>>> cache.get('testing_yo') | |
>>> cache.get('%stesting_yo' % cache.key_prefix) | |
>>> | |
>>> # Using the underlying memcached instance | |
>>> cache._cache.get('testing_yo') | |
'testing, yo!' | |
>>> cache._cache.get('%stesting_yo' % cache.key_prefix) | |
>>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from django.core.cache import cache | |
>>> cache.clear() | |
>>> cache.get('testing_yo') | |
>>> cache.set('testing_yo', 'testing, yo!', 300) | |
>>> cache.key_prefix | |
'' | |
>>> | |
>>> # Using Django's cache framework's get method - THIS IS THE REAL ISSUE | |
>>> cache.get('testing_yo') | |
>>> | |
>>> # Using the underlying memcached instance - THIS IS JUST HERE TO GIVE MORE INFO | |
>>> cache._cache.get('testing_yo') | |
'testing, yo!' | |
>>> cache._cache.get('%stesting_yo' % cache.key_prefix) | |
'testing, yo!' | |
>>> cache._cache.get('%s:1:testing_yo' % cache.key_prefix) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from django.core.cache import cache | |
>>> cache.clear() | |
>>> cache.get('testing_yo') | |
>>> cache.set('testing_yo', 'testing, yo!', 300) | |
>>> cache.key_prefix | |
'' | |
>>> | |
>>> # Using Django's cache framework's get method - THIS IS THE REAL ISSUE | |
>>> cache.get('testing_yo') | |
'testing, yo!' | |
>>> | |
>>> # Using the underlying memcached instance - THIS IS JUST HERE TO GIVE MORE INFO | |
>>> cache._cache.get('testing_yo') | |
>>> cache._cache.get('%stesting_yo' % cache.key_prefix) | |
>>> cache._cache.get('%s:1:testing_yo' % cache.key_prefix) | |
"S'testing, yo!'\np1\n." | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment