Define const for max cache entries

This commit is contained in:
Neil Alexander 2020-04-22 11:11:56 +01:00
parent 3ca36e1319
commit a101b3a713
2 changed files with 5 additions and 1 deletions

View file

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

View file

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