You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
438 B
Go

package cache
import "time"
type NilSetFn func() ([]byte, error)
type Event func(event *redisEvent)
type redisEvent struct {
NilSetLimit time.Duration // 为nil的过期时间自定义
NilSet NilSetFn
}
func WithEventNilSetLimit(expired time.Duration) Event {
return func(event *redisEvent) {
event.NilSetLimit = expired
}
}
func WithNilSet(fn NilSetFn) Event {
return func(event *redisEvent) {
event.NilSet = fn
}
}