gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/client/selector/registry/options.go (about) 1 package registry 2 3 import ( 4 "context" 5 "time" 6 7 "gitee.com/liuxuezhan/go-micro-v1.18.0/client/selector" 8 ) 9 10 // Set the registry cache ttl 11 func TTL(t time.Duration) selector.Option { 12 return func(o *selector.Options) { 13 if o.Context == nil { 14 o.Context = context.Background() 15 } 16 o.Context = context.WithValue(o.Context, "selector_ttl", t) 17 } 18 }