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