forked from TrueCloudLab/frostfs-node
[#1632] node: Configure TTL of Sidechain caches
From now cache TTL can be parameterized in the `neofs-node` app using `cache_ttl` config key. `disable_cache` value is no longer supported. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
5ce8315cd8
commit
fa3124fc33
9 changed files with 35 additions and 33 deletions
|
@ -27,6 +27,8 @@ const (
|
|||
|
||||
// PriorityDefault is a default endpoint priority for the morph client.
|
||||
PriorityDefault = 1
|
||||
|
||||
CacheTTLDefault = 30 * time.Second
|
||||
)
|
||||
|
||||
// RPCEndpoint returns list of the values of "rpc_endpoint" config parameter
|
||||
|
@ -74,8 +76,15 @@ func DialTimeout(c *config.Config) time.Duration {
|
|||
return DialTimeoutDefault
|
||||
}
|
||||
|
||||
// DisableCache returns the value of "disable_cache" config parameter
|
||||
// CacheTTL returns the value of "cache_ttl" config parameter
|
||||
// from "morph" section.
|
||||
func DisableCache(c *config.Config) bool {
|
||||
return config.BoolSafe(c.Sub(subsection), "disable_cache")
|
||||
//
|
||||
// Returns CacheTTLDefault if value is zero or invalid. Supports negative durations.
|
||||
func CacheTTL(c *config.Config) time.Duration {
|
||||
res := config.DurationSafe(c.Sub(subsection), "cache_ttl")
|
||||
if res != 0 {
|
||||
return res
|
||||
}
|
||||
|
||||
return CacheTTLDefault
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue