summary refs log tree commit diff
path: root/synapse/storage/state.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2017-11-13 10:30:38 +0000
committerRichard van der Hoff <richard@matrix.org>2017-11-14 11:43:58 +0000
commit4dd1bfa8c18a3dc9df934a61771ae1e85b313b7e (patch)
tree5277789ee555db0a2ac86c58e2c839eaf99f5fa0 /synapse/storage/state.py
parentMerge pull request #2658 from matrix-org/rav/store_heirarchy_init (diff)
downloadsynapse-4dd1bfa8c18a3dc9df934a61771ae1e85b313b7e.tar.xz
Revert "Revert "move _state_group_cache to statestore""
We're going to fix this properly on this branch, so that the _state_group_cache
can end up in StateGroupReadStore.

This reverts commit ab335edb023d66cd0be439e045b10ca104b73cb5.
Diffstat (limited to '')
-rw-r--r--synapse/storage/state.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index dd01b68762..ee3496123e 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -13,16 +13,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from ._base import SQLBaseStore
-from synapse.util.caches.descriptors import cached, cachedList
-from synapse.util.caches import intern_string
-from synapse.util.stringutils import to_ascii
-from synapse.storage.engines import PostgresEngine
+from collections import namedtuple
+import logging
 
 from twisted.internet import defer
-from collections import namedtuple
 
-import logging
+from synapse.storage.engines import PostgresEngine
+from synapse.util.caches import intern_string, CACHE_SIZE_FACTOR
+from synapse.util.caches.descriptors import cached, cachedList
+from synapse.util.caches.dictionary_cache import DictionaryCache
+from synapse.util.stringutils import to_ascii
+from ._base import SQLBaseStore
 
 logger = logging.getLogger(__name__)
 
@@ -81,6 +82,10 @@ class StateStore(SQLBaseStore):
             where_clause="type='m.room.member'",
         )
 
+        self._state_group_cache = DictionaryCache(
+            "*stateGroupCache*", 100000 * CACHE_SIZE_FACTOR
+        )
+
     @cached(max_entries=100000, iterable=True)
     def get_current_state_ids(self, room_id):
         """Get the current state event ids for a room based on the