aboutsummaryrefslogtreecommitdiff
path: root/internal/caching
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-03-01 17:01:08 +0000
committerNeil Alexander <neilalexander@users.noreply.github.com>2022-03-01 17:01:08 +0000
commit8e82739d77ea472932fd2ff7800ce744ace53bfa (patch)
tree2572d3f6f58fc8efbf238ed6bb29bc0c9b816233 /internal/caching
parentbb2380c254b65a6586137e9e0ab9e08354aa19f4 (diff)
Set max age of 5 minutes for spaces summary cache
Diffstat (limited to 'internal/caching')
-rw-r--r--internal/caching/cache_space_rooms.go7
-rw-r--r--internal/caching/impl_inmemorylru.go1
2 files changed, 7 insertions, 1 deletions
diff --git a/internal/caching/cache_space_rooms.go b/internal/caching/cache_space_rooms.go
index 71b81abc..6d56cce5 100644
--- a/internal/caching/cache_space_rooms.go
+++ b/internal/caching/cache_space_rooms.go
@@ -1,11 +1,16 @@
package caching
-import "github.com/matrix-org/gomatrixserverlib"
+import (
+ "time"
+
+ "github.com/matrix-org/gomatrixserverlib"
+)
const (
SpaceSummaryRoomsCacheName = "space_summary_rooms"
SpaceSummaryRoomsCacheMaxEntries = 100
SpaceSummaryRoomsCacheMutable = true
+ SpaceSummaryRoomsCacheMaxAge = time.Minute * 5
)
type SpaceSummaryRoomsCache interface {
diff --git a/internal/caching/impl_inmemorylru.go b/internal/caching/impl_inmemorylru.go
index c9c8fd08..94fdd1a9 100644
--- a/internal/caching/impl_inmemorylru.go
+++ b/internal/caching/impl_inmemorylru.go
@@ -64,6 +64,7 @@ func NewInMemoryLRUCache(enablePrometheus bool) (*Caches, error) {
SpaceSummaryRoomsCacheName,
SpaceSummaryRoomsCacheMutable,
SpaceSummaryRoomsCacheMaxEntries,
+ SpaceSummaryRoomsCacheMaxAge,
enablePrometheus,
)
if err != nil {