fs/cache: add --fs-cache-expire-duration to control the fs cache

This commit makes the previously statically configured fs cache configurable.

It introduces two parameters `--fs-cache-expire-duration` and
`--fs-cache-expire-interval` to control the caching of the items.

It also adds new interfaces to lib/cache to set these.
This commit is contained in:
Nick Craig-Wood
2021-03-29 17:18:49 +01:00
parent 60bc7a079a
commit c0c74003f2
7 changed files with 119 additions and 19 deletions

View File

@@ -123,6 +123,8 @@ type ConfigInfo struct {
RefreshTimes bool
NoConsole bool
TrafficClass uint8
FsCacheExpireDuration time.Duration
FsCacheExpireInterval time.Duration
}
// NewConfig creates a new config with everything set to the default
@@ -160,6 +162,8 @@ func NewConfig() *ConfigInfo {
c.MultiThreadStreams = 4
c.TrackRenamesStrategy = "hash"
c.FsCacheExpireDuration = 300 * time.Second
c.FsCacheExpireInterval = 60 * time.Second
return c
}