diff --git a/common/caching/cache.go b/common/caching/cache.go index 09edb44f9..83404fecf 100644 --- a/common/caching/cache.go +++ b/common/caching/cache.go @@ -2,6 +2,10 @@ package caching import "github.com/matrix-org/gomatrixserverlib" +const ( + MaxRoomVersionCacheEntries = 128 +) + type Cache interface { GetRoomVersion(roomId string) (gomatrixserverlib.RoomVersion, bool) StoreRoomVersion(roomId string, roomVersion gomatrixserverlib.RoomVersion) diff --git a/common/caching/inmemorylru.go b/common/caching/inmemorylru.go index df9295ba2..89101f4a2 100644 --- a/common/caching/inmemorylru.go +++ b/common/caching/inmemorylru.go @@ -10,7 +10,7 @@ type InMemoryLRUCache struct { } func NewInMemoryLRUCache() (*InMemoryLRUCache, error) { - roomVersionCache, rvErr := lru.New(128) + roomVersionCache, rvErr := lru.New(MaxRoomVersionCacheEntries) if rvErr != nil { return nil, rvErr }