#15149: Memcached backend: possible issue with cache keys
----------------------------------------------+-----------------------------
               Reporter:  jeff@…              |         Owner:  nobody   
                 Status:  new                 |     Milestone:           
              Component:  Cache system        |       Version:  SVN      
             Resolution:                      |      Keywords:  memcached
           Triage Stage:  Unreviewed          |     Has patch:  0        
    Needs documentation:  0                   |   Needs tests:  0        
Patch needs improvement:  0                   |  
----------------------------------------------+-----------------------------

Comment (by jeff@…):

 Purging .pyc files didn't help. I even tried a totally fresh checkout of
 Django trunk. Here's the results:

 {{{
 >>> from django.core.cache import cache
 >>> cache.clear()
 >>> cache.get('testing_yo')
 >>> cache.set('testing_yo', 'testing, yo!', 300)
 >>> cache.key_prefix
 'lendle_'
 >>>
 >>> # 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)
 >>> cache._cache.get('%s:1:testing_yo' % cache.key_prefix)

 }}}



 However, it DOES seem to work if I use get_cache() directly:

 {{{
 >>> from django.core.cache import cache
 >>> mycache = get_cache('default')
 >>> mycache.clear()
 >>> mycache.get('testing_yo')
 >>> mycache.set('testing_yo', 'testing, yo!', 300)
 >>> mycache.key_prefix
 'lendle_'
 >>>
 >>> # Using Django's cache framework's get method - THIS IS THE REAL ISSUE
 >>> mycache.get('testing_yo')
 'testing, yo!'
 >>>
 >>> # Using the underlying memcached instance - THIS IS JUST HERE TO GIVE
 MORE INFO
 >>> mycache._cache.get('testing_yo')
 >>> mycache._cache.get('%stesting_yo' % cache.key_prefix)
 >>> mycache._cache.get('%s:1:testing_yo' % cache.key_prefix)
 'testing, yo!'

 }}}

 And if I use a manually instantiated cache object:

 {{{
 >>> from django.core.cache.backends.memcached import MemcachedCache
 >>> mycache = MemcachedCache('127.0.0.1:11211', {'KEY_PREFIX': 'lendle_'})
 >>> mycache.clear()
 >>> mycache.get('testing_yo')
 >>> mycache.set('testing_yo', 'testing, yo!', 300)
 >>> mycache.key_prefix
 'lendle_'
 >>>
 >>> # Using Django's cache framework's get method - THIS IS THE REAL ISSUE
 >>> mycache.get('testing_yo')
 'testing, yo!'
 >>>
 >>> # Using the underlying memcached instance - THIS IS JUST HERE TO GIVE
 MORE INFO
 >>> mycache._cache.get('testing_yo')
 >>> mycache._cache.get('%stesting_yo' % cache.key_prefix)
 >>> mycache._cache.get('%s:1:testing_yo' % cache.key_prefix)
 'testing, yo!'

 }}}

 PROGRESS!

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15149#comment:11>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to