diff --git a/cmd/thanos/query_frontend.go b/cmd/thanos/query_frontend.go index bc3c0f1b20..5ac7342bf8 100644 --- a/cmd/thanos/query_frontend.go +++ b/cmd/thanos/query_frontend.go @@ -106,7 +106,10 @@ func runQueryFrontend( if err != nil { return errors.Wrap(err, "initializing the query frontend config") } - + if cfg.CortexResultsCacheConfig.CacheConfig.Memcache.Expiration == 0 { + level.Warn(logger).Log("msg", "memcached cache valid time set to 0, so using a default of 24 hours expiration time") + cfg.CortexResultsCacheConfig.CacheConfig.Memcache.Expiration = 24 * time.Hour + } cfg.CortexResultsCacheConfig = &queryrange.ResultsCacheConfig{ Compression: cfg.CacheCompression, CacheConfig: *cacheConfig, diff --git a/pkg/queryfrontend/config.go b/pkg/queryfrontend/config.go index b2b9e77ecf..3df378e76a 100644 --- a/pkg/queryfrontend/config.go +++ b/pkg/queryfrontend/config.go @@ -88,11 +88,6 @@ func NewCacheConfig(logger log.Logger, confContentYaml []byte) (*cortexcache.Con level.Warn(logger).Log("message", "MaxItemSize is not yet supported by the memcached client") } - if config.Expiration == 0 { - level.Warn(logger).Log("msg", "memcached cache valid time set to 0, so using a default of 24 hours expiration time") - config.Expiration = 24 * time.Hour - } - return &cortexcache.Config{ Memcache: cortexcache.MemcachedConfig{ Expiration: config.Expiration,