redisdb/options.go

27 lines
334 B
Go

package redisdb
import "time"
type allOptions struct {
ttl time.Duration
}
type Options interface {
apply(*allOptions)
}
//
// TTL
//
type ttlOption struct {
Value time.Duration
}
func (o ttlOption) apply(opts *allOptions) {
opts.ttl = o.Value
}
func WithTTL(value time.Duration) Options {
return ttlOption{Value: value}
}