summary refs log tree commit diff
path: root/synapse/util/caches/descriptors.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-02-02 15:23:45 +0000
committerErik Johnston <erik@matrix.org>2017-02-02 15:23:45 +0000
commit99fa03e8b55eee0d69f654ba61c3f31f9f6afde1 (patch)
tree5eccc1feae37e9ba87085718a6340e1d0147ad2f /synapse/util/caches/descriptors.py
parentsets aren't JSON serializable (diff)
parentMerge pull request #1876 from matrix-org/erikj/shared_member_store (diff)
downloadsynapse-99fa03e8b55eee0d69f654ba61c3f31f9f6afde1.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/device_list_fixes
Diffstat (limited to 'synapse/util/caches/descriptors.py')
-rw-r--r--synapse/util/caches/descriptors.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/util/caches/descriptors.py b/synapse/util/caches/descriptors.py
index 675bfd5feb..998de70d29 100644
--- a/synapse/util/caches/descriptors.py
+++ b/synapse/util/caches/descriptors.py
@@ -478,6 +478,11 @@ class CacheListDescriptor(object):
 
 
 class _CacheContext(namedtuple("_CacheContext", ("cache", "key"))):
+    # We rely on _CacheContext implementing __eq__ and __hash__ sensibly,
+    # which namedtuple does for us (i.e. two _CacheContext are the same if
+    # their caches and keys match). This is important in particular to
+    # dedupe when we add callbacks to lru cache nodes, otherwise the number
+    # of callbacks would grow.
     def invalidate(self):
         self.cache.invalidate(self.key)