mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
6284790f98
- No longer rely on *Event returning from NewEventFrom... functions Requires https://github.com/matrix-org/gomatrixserverlib/pull/377
25 lines
820 B
Go
25 lines
820 B
Go
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 {
|
|
GetRoomServerEvent(eventNID types.EventNID) (*types.HeaderedEvent, bool)
|
|
StoreRoomServerEvent(eventNID types.EventNID, event *types.HeaderedEvent)
|
|
InvalidateRoomServerEvent(eventNID types.EventNID)
|
|
}
|
|
|
|
func (c Caches) GetRoomServerEvent(eventNID types.EventNID) (*types.HeaderedEvent, bool) {
|
|
return c.RoomServerEvents.Get(int64(eventNID))
|
|
}
|
|
|
|
func (c Caches) StoreRoomServerEvent(eventNID types.EventNID, event *types.HeaderedEvent) {
|
|
c.RoomServerEvents.Set(int64(eventNID), event)
|
|
}
|
|
|
|
func (c Caches) InvalidateRoomServerEvent(eventNID types.EventNID) {
|
|
c.RoomServerEvents.Unset(int64(eventNID))
|
|
}
|