0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-16 15:01:23 +01:00

Add cache to get_user_by_id

This commit is contained in:
Erik Johnston 2016-05-09 10:08:21 +01:00
parent 96d9d5d388
commit 4ea762c1a2

View file

@ -101,6 +101,7 @@ class RegistrationStore(SQLBaseStore):
make_guest, make_guest,
appservice_id appservice_id
) )
self.get_user_by_id.invalidate((user_id,))
self.is_guest.invalidate((user_id,)) self.is_guest.invalidate((user_id,))
def _register( def _register(
@ -156,6 +157,7 @@ class RegistrationStore(SQLBaseStore):
(next_id, user_id, token,) (next_id, user_id, token,)
) )
@cached()
def get_user_by_id(self, user_id): def get_user_by_id(self, user_id):
return self._simple_select_one( return self._simple_select_one(
table="users", table="users",
@ -193,6 +195,7 @@ class RegistrationStore(SQLBaseStore):
}, { }, {
'password_hash': password_hash 'password_hash': password_hash
}) })
self.get_user_by_id.invalidate((user_id,))
@defer.inlineCallbacks @defer.inlineCallbacks
def user_delete_access_tokens(self, user_id, except_token_ids=[]): def user_delete_access_tokens(self, user_id, except_token_ids=[]):