micro/client/selector/registry/options.go
2019-06-21 15:13:54 +01:00

19 lines
336 B
Go

package registry
import (
"context"
"time"
"github.com/micro/go-micro/client/selector"
)
// Set the registry cache ttl
func TTL(t time.Duration) selector.Option {
return func(o *selector.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, "selector_ttl", t)
}
}