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