Cache latest_event_ids_in_room

This commit is contained in:
Erik Johnston 2015-05-01 13:06:26 +01:00
parent 657298cebd
commit 4011cf1c42
1 changed files with 4 additions and 1 deletions

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from ._base import SQLBaseStore from ._base import SQLBaseStore, cached
from syutil.base64util import encode_base64 from syutil.base64util import encode_base64
import logging import logging
@ -96,6 +96,7 @@ class EventFederationStore(SQLBaseStore):
room_id, room_id,
) )
@cached()
def get_latest_event_ids_in_room(self, room_id): def get_latest_event_ids_in_room(self, room_id):
return self._simple_select_onecol( return self._simple_select_onecol(
table="event_forward_extremities", table="event_forward_extremities",
@ -329,6 +330,8 @@ class EventFederationStore(SQLBaseStore):
) )
txn.execute(query) txn.execute(query)
self.get_latest_event_ids_in_room.invalidate(room_id)
def get_backfill_events(self, room_id, event_list, limit): def get_backfill_events(self, room_id, event_list, limit):
"""Get a list of Events for a given topic that occurred before (and """Get a list of Events for a given topic that occurred before (and
including) the events in event_list. Return a list of max size `limit` including) the events in event_list. Return a list of max size `limit`