2020-08-25 11:32:29 +00:00
|
|
|
package caching
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/matrix-org/dendrite/roomserver/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
type RoomServerCaches interface {
|
|
|
|
RoomServerNIDsCache
|
|
|
|
RoomVersionCache
|
2020-12-16 12:15:12 +00:00
|
|
|
RoomInfoCache
|
2022-07-11 13:31:31 +00:00
|
|
|
RoomServerEventsCache
|
2020-08-25 11:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// RoomServerNIDsCache contains the subset of functions needed for
|
|
|
|
// a roomserver NID cache.
|
|
|
|
type RoomServerNIDsCache interface {
|
|
|
|
GetRoomServerRoomID(roomNID types.RoomNID) (string, bool)
|
|
|
|
StoreRoomServerRoomID(roomNID types.RoomNID, roomID string)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c Caches) GetRoomServerRoomID(roomNID types.RoomNID) (string, bool) {
|
2022-07-11 13:31:31 +00:00
|
|
|
return c.RoomServerRoomIDs.Get(int64(roomNID))
|
2020-08-25 11:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c Caches) StoreRoomServerRoomID(roomNID types.RoomNID, roomID string) {
|
2022-07-11 13:31:31 +00:00
|
|
|
c.RoomServerRoomIDs.Set(int64(roomNID), roomID)
|
2020-08-25 11:32:29 +00:00
|
|
|
}
|