2019-07-28 18:56:18 +01:00
|
|
|
package pool
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2020-07-27 13:22:00 +01:00
|
|
|
"github.com/micro/go-micro/v3/transport"
|
2019-07-28 18:56:18 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type Options struct {
|
|
|
|
Transport transport.Transport
|
|
|
|
TTL time.Duration
|
|
|
|
Size int
|
|
|
|
}
|
|
|
|
|
|
|
|
type Option func(*Options)
|
|
|
|
|
|
|
|
func Size(i int) Option {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.Size = i
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func Transport(t transport.Transport) Option {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.Transport = t
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TTL(t time.Duration) Option {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.TTL = t
|
|
|
|
}
|
|
|
|
}
|