2022-07-11 14:31:31 +01:00
|
|
|
package caching
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/matrix-org/dendrite/roomserver/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// RoomServerEventsCache contains the subset of functions needed for
|
|
|
|
// a roomserver event cache.
|
|
|
|
type RoomServerEventsCache interface {
|
2023-05-03 10:21:27 +01:00
|
|
|
GetRoomServerEvent(eventNID types.EventNID) (*types.HeaderedEvent, bool)
|
|
|
|
StoreRoomServerEvent(eventNID types.EventNID, event *types.HeaderedEvent)
|
2023-03-09 08:52:13 +00:00
|
|
|
InvalidateRoomServerEvent(eventNID types.EventNID)
|
2022-07-11 14:31:31 +01:00
|
|
|
}
|
|
|
|
|
2023-05-03 10:21:27 +01:00
|
|
|
func (c Caches) GetRoomServerEvent(eventNID types.EventNID) (*types.HeaderedEvent, bool) {
|
2022-07-11 14:31:31 +01:00
|
|
|
return c.RoomServerEvents.Get(int64(eventNID))
|
|
|
|
}
|
|
|
|
|
2023-05-03 10:21:27 +01:00
|
|
|
func (c Caches) StoreRoomServerEvent(eventNID types.EventNID, event *types.HeaderedEvent) {
|
2022-07-11 14:31:31 +01:00
|
|
|
c.RoomServerEvents.Set(int64(eventNID), event)
|
|
|
|
}
|
2023-03-09 08:52:13 +00:00
|
|
|
|
|
|
|
func (c Caches) InvalidateRoomServerEvent(eventNID types.EventNID) {
|
|
|
|
c.RoomServerEvents.Unset(int64(eventNID))
|
|
|
|
}
|