Skip to content

Commit

Permalink
adjust cache resolver default parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
bachue committed Jan 24, 2024
1 parent 0809487 commit 71ee70c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions storagev2/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type (
// 主备域名冻结时间(默认:600s),当一个域名请求失败(单个域名会被重试 RetryMax 次),会被冻结一段时间,使用备用域名进行重试,在冻结时间内,域名不能被使用,当一个操作中所有域名竣备冻结操作不在进行重试,返回最后一次操作的错误。
HostFreezeDuration time.Duration

// 缓存有效期(默认:300s
// 缓存有效期(默认:120s
CacheLifetime time.Duration
}

Expand All @@ -89,16 +89,16 @@ func NewCacheResolver(resolver Resolver, opts *CacheResolverOptions) (Resolver,
opts = &CacheResolverOptions{}
}
if opts.CompactInterval == time.Duration(0) {
opts.CompactInterval = time.Minute
opts.CompactInterval = 60 * time.Second
}
if opts.PersistentFilePath == "" {
opts.PersistentFilePath = filepath.Join(os.TempDir(), "qiniu-golang-sdk", cacheFileName)
}
if opts.PersistentDuration == time.Duration(0) {
opts.PersistentDuration = time.Minute
opts.PersistentDuration = 60 * time.Second
}
if opts.CacheLifetime == time.Duration(0) {
opts.CacheLifetime = 300 * time.Second
opts.CacheLifetime = 120 * time.Second
}
if resolver == nil {
resolver = staticDefaultResolver
Expand Down

0 comments on commit 71ee70c

Please sign in to comment.