mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 03:43:11 -06:00
Define const for max cache entries
This commit is contained in:
parent
3ca36e1319
commit
a101b3a713
|
|
@ -2,6 +2,10 @@ package caching
|
||||||
|
|
||||||
import "github.com/matrix-org/gomatrixserverlib"
|
import "github.com/matrix-org/gomatrixserverlib"
|
||||||
|
|
||||||
|
const (
|
||||||
|
MaxRoomVersionCacheEntries = 128
|
||||||
|
)
|
||||||
|
|
||||||
type Cache interface {
|
type Cache interface {
|
||||||
GetRoomVersion(roomId string) (gomatrixserverlib.RoomVersion, bool)
|
GetRoomVersion(roomId string) (gomatrixserverlib.RoomVersion, bool)
|
||||||
StoreRoomVersion(roomId string, roomVersion gomatrixserverlib.RoomVersion)
|
StoreRoomVersion(roomId string, roomVersion gomatrixserverlib.RoomVersion)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ type InMemoryLRUCache struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewInMemoryLRUCache() (*InMemoryLRUCache, error) {
|
func NewInMemoryLRUCache() (*InMemoryLRUCache, error) {
|
||||||
roomVersionCache, rvErr := lru.New(128)
|
roomVersionCache, rvErr := lru.New(MaxRoomVersionCacheEntries)
|
||||||
if rvErr != nil {
|
if rvErr != nil {
|
||||||
return nil, rvErr
|
return nil, rvErr
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue