Fix buggy key computation in cache_with_key.

The refactoring to use the cache_get() method incorrectly didn't
remove the addition of KEY_PREFIX inside cache_with_key.  The result
was that the KEY_PREFIX was being added twice, once by cache_with_key
and again inside cache_get.

This had the impact of causing pointer saves to not take effect,
because our attempts to update the memcached cache when we save the
UserProfile object were using the correct cache key, but the actual
code reading values out of the caceh wasn't.

(imported from commit dcea000833f00622bdc0249488de3b186a7417b2)
This commit is contained in:
Tim Abbott
2013-06-20 10:41:23 -04:00
parent c5631eb489
commit 47255e9cd8

View File

@@ -79,7 +79,7 @@ def cache_with_key(keyfunc, cache_name=None, timeout=None, with_statsd_key=None)
def decorator(func):
@wraps(func)
def func_with_caching(*args, **kwargs):
key = KEY_PREFIX + keyfunc(*args, **kwargs)
key = keyfunc(*args, **kwargs)
val = cache_get(key, cache_name=cache_name)