goconsistencehash/option.go
2025-05-07 10:34:10 +08:00

27 lines
375 B
Go

package consistencehash
type Options struct {
replicas int
lockExpire int
}
type Option func(o *Options)
func (o *Options) repire() {
if o.replicas <= 0 {
o.replicas = 5
}
}
func WithReplicas(replicas int) Option {
return func(o *Options) {
o.replicas = replicas
}
}
func WithLockExpire(expire int)Option{
return func(o *Options) {
o.lockExpire=expire
}
}