summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-08-10 13:47:51 +0100
committerErik Johnston <erik@matrix.org>2015-08-10 13:47:51 +0100
commit7ce71f2ffc60549f16a5020c7f891546f33d4a30 (patch)
treeeea76ae320a515efb19ed1e7e8f1d43becddc411 /synapse
parentMerge branch 'erikj/cache_varargs_interface' of github.com:matrix-org/synapse... (diff)
parentRename keyargs to args in CacheDescriptor (diff)
downloadsynapse-7ce71f2ffc60549f16a5020c7f891546f33d4a30.tar.xz
Merge branch 'erikj/cache_varargs_interface' of github.com:matrix-org/synapse into erikj/dictionary_cache
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/_base.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index a7590145ac..27713e8b74 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -182,9 +182,9 @@ class CacheDescriptor(object):
         @functools.wraps(self.orig)
         def wrapped(*args, **kwargs):
             arg_dict = inspect.getcallargs(self.orig, obj, *args, **kwargs)
-            keyargs = tuple(arg_dict[arg_nm] for arg_nm in self.arg_names)
+            cache_key = tuple(arg_dict[arg_nm] for arg_nm in self.arg_names)
             try:
-                cached_result_d = self.cache.get(keyargs)
+                cached_result_d = self.cache.get(cache_key)
 
                 observer = cached_result_d.observe()
                 if DEBUG_CACHES:
@@ -194,7 +194,7 @@ class CacheDescriptor(object):
                         if actual_result != cached_result:
                             logger.error(
                                 "Stale cache entry %s%r: cached: %r, actual %r",
-                                self.orig.__name__, keyargs,
+                                self.orig.__name__, cache_key,
                                 cached_result, actual_result,
                             )
                             raise ValueError("Stale cache entry")
@@ -214,13 +214,13 @@ class CacheDescriptor(object):
                 )
 
                 def onErr(f):
-                    self.cache.invalidate(keyargs)
+                    self.cache.invalidate(cache_key)
                     return f
 
                 ret.addErrback(onErr)
 
                 ret = ObservableDeferred(ret, consumeErrors=True)
-                self.cache.update(sequence, keyargs, ret)
+                self.cache.update(sequence, cache_key, ret)
 
                 return ret.observe()