github.com/annwntech/go-micro/v2@v2.9.5/client/selector/registry/options.go (about) 1 package registry 2 3 import ( 4 "context" 5 "time" 6 7 "github.com/annwntech/go-micro/v2/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 }