diff options
author | Erik Johnston <erik@matrix.org> | 2015-08-17 10:46:55 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-08-17 10:46:55 +0100 |
commit | 2d97e65558f37fa0fbdd8d06545c32b410f1b5ed (patch) | |
tree | 7b4da073820ae1238baecb689e6228d87bbe6fb4 /synapse/storage | |
parent | Implement a batched presence_handler.get_state and use it (diff) | |
download | synapse-2d97e65558f37fa0fbdd8d06545c32b410f1b5ed.tar.xz |
Remember to invalidate caches
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/presence.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/storage/presence.py b/synapse/storage/presence.py index 15d98198e2..9b136f3119 100644 --- a/synapse/storage/presence.py +++ b/synapse/storage/presence.py @@ -21,12 +21,15 @@ from twisted.internet import defer class PresenceStore(SQLBaseStore): def create_presence(self, user_localpart): - return self._simple_insert( + res = self._simple_insert( table="presence", values={"user_id": user_localpart}, desc="create_presence", ) + self.get_presence_state.invalidate((user_localpart,)) + return res + def has_presence_state(self, user_localpart): return self._simple_select_one( table="presence", @@ -65,7 +68,7 @@ class PresenceStore(SQLBaseStore): return self.runInteraction("get_presence_states", f) def set_presence_state(self, user_localpart, new_state): - return self._simple_update_one( + res = self._simple_update_one( table="presence", keyvalues={"user_id": user_localpart}, updatevalues={"state": new_state["state"], @@ -74,6 +77,9 @@ class PresenceStore(SQLBaseStore): desc="set_presence_state", ) + self.get_presence_state.invalidate((user_localpart,)) + return res + def allow_presence_visible(self, observed_localpart, observer_userid): return self._simple_insert( table="presence_allow_inbound", |