mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-04 12:36:37 +08:00
Add configurable memory limits and LRU eviction for runtime cache
This commit is contained in:
@@ -119,6 +119,22 @@ func ApplyRuntimeSetting(cfg *config.Config, key, value string) {
|
||||
}
|
||||
cfg.Cache.ImagesMaxSizeMB = n
|
||||
}
|
||||
case "cache.memory_max_size_mb":
|
||||
n := config.DefaultCacheMemoryMaxSizeMB
|
||||
if value != "" {
|
||||
parsed, err := strconv.Atoi(value)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
n = parsed
|
||||
}
|
||||
if n <= 0 {
|
||||
n = config.DefaultCacheMemoryMaxSizeMB
|
||||
}
|
||||
if n > 4096 {
|
||||
n = 4096
|
||||
}
|
||||
cfg.Cache.MemoryMaxSizeMB = n
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user