v1.3.2 fix cfg bug

This commit is contained in:
bryanqiu 2023-04-28 09:00:12 +08:00
parent 4ce4df224c
commit 89b9506902

View File

@ -63,7 +63,6 @@ type Config struct {
func NewCache[T any](getter Getter[T], cfg Config) Cacher[T] {
var c = new(cacher[T])
// Getter
c.cfg = cfg
c.getter = getter
// Local cache
@ -100,6 +99,7 @@ func NewCache[T any](getter Getter[T], cfg Config) Cacher[T] {
cfg.UseExpiredCache = &[]bool{true}[0]
}
c.cfg = cfg
name := reflect.TypeOf(*new(T)).String()
log.PrintPretty("new cache '"+name+"' by config:", cfg)
return c