summary refs log tree commit diff
path: root/synapse/storage/__init__.py
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2015-02-11 15:44:09 +0000
committerMark Haines <mjark@negativecurvature.net>2015-02-11 15:44:09 +0000
commit40f332e5348bd301bb623870eddb3adf1ca363f3 (patch)
tree20f3eda004e9b35217263033a525382dbaac6422 /synapse/storage/__init__.py
parentMention new libs in CHANGES (diff)
parentInvalidate the cache for an event if it is redacted (diff)
downloadsynapse-40f332e5348bd301bb623870eddb3adf1ca363f3.tar.xz
Merge pull request #65 from matrix-org/get_event_cache
Add an in-memory cache for get_event in the storage layer
Diffstat (limited to 'synapse/storage/__init__.py')
-rw-r--r--synapse/storage/__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index a63c59a8a2..a33e2298f6 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -164,6 +164,9 @@ class DataStore(RoomMemberStore, RoomStore,
                            stream_ordering=None, is_new_state=True,
                            current_state=None):
 
+        # Remove the any existing cache entries for the event_id
+        self._get_event_cache.pop(event.event_id)
+
         # We purposefully do this first since if we include a `current_state`
         # key, we *want* to update the `current_state_events` table
         if current_state:
@@ -420,6 +423,8 @@ class DataStore(RoomMemberStore, RoomStore,
         )
 
     def _store_redaction(self, txn, event):
+        # invalidate the cache for the redacted event
+        self._get_event_cache.pop(event.redacts)
         txn.execute(
             "INSERT OR IGNORE INTO redactions "
             "(event_id, redacts) VALUES (?,?)",