mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-21 05:43:09 -06:00
Populate caches
This commit is contained in:
parent
38547192d7
commit
ede9da20dd
|
|
@ -69,6 +69,7 @@ func (d *Database) EventTypeNIDs(
|
||||||
}
|
}
|
||||||
for eventType, nid := range nids {
|
for eventType, nid := range nids {
|
||||||
result[eventType] = nid
|
result[eventType] = nid
|
||||||
|
d.Cache.StoreRoomServerEventTypeNID(eventType, nid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
|
|
@ -99,6 +100,7 @@ func (d *Database) EventStateKeyNIDs(
|
||||||
}
|
}
|
||||||
for eventStateKey, nid := range nids {
|
for eventStateKey, nid := range nids {
|
||||||
result[eventStateKey] = nid
|
result[eventStateKey] = nid
|
||||||
|
d.Cache.StoreRoomServerStateKeyNID(eventStateKey, nid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
|
|
@ -202,6 +204,7 @@ func (d *Database) RoomNID(ctx context.Context, roomID string) (types.RoomNID, e
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
d.Cache.StoreRoomServerRoomNID(roomID, roomNID)
|
||||||
return roomNID, err
|
return roomNID, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,6 +216,7 @@ func (d *Database) RoomNIDExcludingStubs(ctx context.Context, roomID string) (ro
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
d.Cache.StoreRoomServerRoomNID(roomID, roomNID)
|
||||||
}
|
}
|
||||||
latestEvents, _, err := d.RoomsTable.SelectLatestEventNIDs(ctx, nil, roomNID)
|
latestEvents, _, err := d.RoomsTable.SelectLatestEventNIDs(ctx, nil, roomNID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue