diff --git a/internal/cache/gache/gache.go b/internal/cache/gache/gache.go index c809818cd1..a242c15058 100644 --- a/internal/cache/gache/gache.go +++ b/internal/cache/gache/gache.go @@ -33,7 +33,7 @@ type cache struct { func New(opts ...Option) (c *cache) { c = new(cache) - for _, opt := range append(defaultOpts, opts...) { + for _, opt := range append(defaultOptions(), opts...) { opt(c) } c.gache.SetDefaultExpire(c.expireDur) diff --git a/internal/cache/gache/option.go b/internal/cache/gache/option.go index 1974046492..6e98c285b6 100644 --- a/internal/cache/gache/option.go +++ b/internal/cache/gache/option.go @@ -26,11 +26,11 @@ import ( type Option func(*cache) -var ( - defaultOpts = []Option{ +func defaultOptions() []Option { + return []Option{ WithGache(gache.New()), } -) +} func WithGache(g gache.Gache) Option { return func(c *cache) {