1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-18 08:26:38 +02:00
go-micro/client/selector/registry/options.go

19 lines
336 B
Go
Raw Normal View History

package registry
2016-05-03 20:26:50 +02:00
import (
2018-03-03 13:53:52 +02:00
"context"
2016-05-03 20:26:50 +02:00
"time"
2019-06-21 16:13:54 +02:00
"github.com/micro/go-micro/client/selector"
2016-05-03 20:26:50 +02:00
)
// Set the registry cache ttl
2016-05-03 20:26:50 +02:00
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)
2016-05-03 20:26:50 +02:00
}
}