redisdb/options.go

27 lines
334 B
Go
Raw Permalink Normal View History

2022-12-05 07:54:51 +00:00
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}
}