mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-23 01:55:53 +03:00
Merge pull request #772 from matrix-org/erikj/get_user_cache
Add cache to get_user_by_id
This commit is contained in:
commit
8715731559
1 changed files with 3 additions and 0 deletions
|
@ -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=[]):
|
||||
|
|
Loading…
Reference in a new issue