2022-07-11 13:31:31 +00: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 09:21:27 +00: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 13:31:31 +00:00
|
|
|
}
|
|
|
|
|
2023-05-03 09:21:27 +00:00
|
|
|
func (c Caches) GetRoomServerEvent(eventNID types.EventNID) (*types.HeaderedEvent, bool) {
|
2022-07-11 13:31:31 +00:00
|
|
|
return c.RoomServerEvents.Get(int64(eventNID))
|
|
|
|
}
|
|
|
|
|
2023-05-03 09:21:27 +00:00
|
|
|
func (c Caches) StoreRoomServerEvent(eventNID types.EventNID, event *types.HeaderedEvent) {
|
2022-07-11 13:31:31 +00: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))
|
|
|
|
}
|