From 8e82739d77ea472932fd2ff7800ce744ace53bfa Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 1 Mar 2022 17:01:08 +0000 Subject: [PATCH] Set max age of 5 minutes for spaces summary cache --- internal/caching/cache_space_rooms.go | 7 ++++++- internal/caching/impl_inmemorylru.go | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) 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 {