70322699ab
This should deflake UTs and be more correct in terms of getting `Events`. `Events` tries to fetch the event from the cache first and may get an unredacted event from it, while it should already be redacted.
27 lines
879 B
Go
27 lines
879 B
Go
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)
|
|
InvalidateRoomServerEvent(eventNID types.EventNID)
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
func (c Caches) InvalidateRoomServerEvent(eventNID types.EventNID) {
|
|
c.RoomServerEvents.Unset(int64(eventNID))
|
|
}
|