diff options
author | Erik Johnston <erik@matrix.org> | 2016-09-15 14:27:15 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-09-15 14:28:13 +0100 |
commit | cb3edec6af55efb126f5e7ee66c4d895ef35a66e (patch) | |
tree | a80740335d559f06a7568aa633b7ac78ac2e0e00 /synapse/util/caches | |
parent | Add cache to get_forward_extremeties_for_room (diff) | |
download | synapse-cb3edec6af55efb126f5e7ee66c4d895ef35a66e.tar.xz |
Use stream_change cache to make get_forward_extremeties_for_room cache more effective
Diffstat (limited to 'synapse/util/caches')
-rw-r--r-- | synapse/util/caches/stream_change_cache.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/util/caches/stream_change_cache.py b/synapse/util/caches/stream_change_cache.py index 3c051dabc4..5c2a433e41 100644 --- a/synapse/util/caches/stream_change_cache.py +++ b/synapse/util/caches/stream_change_cache.py @@ -121,3 +121,8 @@ class StreamChangeCache(object): k, r = self._cache.popitem() self._earliest_known_stream_pos = max(k, self._earliest_known_stream_pos) self._entity_to_key.pop(r, None) + + def get_pos_of_last_change(self, entity): + """Returns the stream pos of the last change for an entitiy, if known. + """ + return self._entity_to_key.get(entity, None) |