summary refs log tree commit diff
path: root/synapse/storage/registration.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-05-09 11:12:11 +0100
committerErik Johnston <erik@matrix.org>2016-05-09 11:12:11 +0100
commit8715731559c311d3fce06ef5de9f28baecfe84a1 (patch)
treecfe71d0d7c5600192c8ed04ad7f5a02ce24a2a1a /synapse/storage/registration.py
parentMerge pull request #770 from matrix-org/erikj/transaction_reactor (diff)
parentAdd cache to get_user_by_id (diff)
downloadsynapse-8715731559c311d3fce06ef5de9f28baecfe84a1.tar.xz
Merge pull request #772 from matrix-org/erikj/get_user_cache
Add cache to get_user_by_id
Diffstat (limited to 'synapse/storage/registration.py')
-rw-r--r--synapse/storage/registration.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 7af0cae6a5..bda84a744a 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -101,6 +101,7 @@ class RegistrationStore(SQLBaseStore):
             make_guest,
             appservice_id
         )
+        self.get_user_by_id.invalidate((user_id,))
         self.is_guest.invalidate((user_id,))
 
     def _register(
@@ -156,6 +157,7 @@ class RegistrationStore(SQLBaseStore):
                 (next_id, user_id, token,)
             )
 
+    @cached()
     def get_user_by_id(self, user_id):
         return self._simple_select_one(
             table="users",
@@ -193,6 +195,7 @@ class RegistrationStore(SQLBaseStore):
         }, {
             'password_hash': password_hash
         })
+        self.get_user_by_id.invalidate((user_id,))
 
     @defer.inlineCallbacks
     def user_delete_access_tokens(self, user_id, except_token_ids=[]):