aboutsummaryrefslogtreecommitdiff
path: root/internal/caching/cache_roomevents.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/caching/cache_roomevents.go')
-rw-r--r--internal/caching/cache_roomevents.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/caching/cache_roomevents.go b/internal/caching/cache_roomevents.go
new file mode 100644
index 00000000..9d5d3b91
--- /dev/null
+++ b/internal/caching/cache_roomevents.go
@@ -0,0 +1,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)
+}