summary refs log tree commit diff
path: root/synapse/util/caches/expiringcache.py
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2016-06-03 14:51:33 +0100
committerMark Haines <mjark@negativecurvature.net>2016-06-03 14:51:33 +0100
commitdd6f62ed99033d7c793685b6cce5dfba9d3aff89 (patch)
tree0044c60b4100253a0875be891bbb4ecfce80d47c /synapse/util/caches/expiringcache.py
parentSend updates to the syncing users every ten seconds or immediately if they've... (diff)
parentMerge pull request #833 from matrix-org/markjh/client_ips (diff)
downloadsynapse-dd6f62ed99033d7c793685b6cce5dfba9d3aff89.tar.xz
Merge branch 'develop' into markjh/synchrotronII
Diffstat (limited to 'synapse/util/caches/expiringcache.py')
-rw-r--r--synapse/util/caches/expiringcache.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/util/caches/expiringcache.py b/synapse/util/caches/expiringcache.py
index 2b68c1ac93..080388958f 100644
--- a/synapse/util/caches/expiringcache.py
+++ b/synapse/util/caches/expiringcache.py
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from synapse.util.caches import cache_counter, caches_by_name
+from synapse.util.caches import register_cache
 
 import logging
 
@@ -49,7 +49,7 @@ class ExpiringCache(object):
 
         self._cache = {}
 
-        caches_by_name[cache_name] = self._cache
+        self.metrics = register_cache(cache_name, self._cache)
 
     def start(self):
         if not self._expiry_ms:
@@ -78,9 +78,9 @@ class ExpiringCache(object):
     def __getitem__(self, key):
         try:
             entry = self._cache[key]
-            cache_counter.inc_hits(self._cache_name)
+            self.metrics.inc_hits()
         except KeyError:
-            cache_counter.inc_misses(self._cache_name)
+            self.metrics.inc_misses()
             raise
 
         if self._reset_expiry_on_get: