aboutsummaryrefslogtreecommitdiff
path: root/internal/caching/cache_roomevents.go
blob: 9d5d3b912a90756acb065d9c7fc3486bd53a0e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)
}

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)
}