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