Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeleteHook ¶
type DeleteHook func(key interface{})
type Deleter ¶
type Deleter struct { DeleteFunc DeleteHook Interval time.Duration Name string Now func() time.Time // contains filtered or unexported fields }
Deleter implements a clean up mechanism. Deleter keeps at least `keep` items. The items must be younger then `maxAge`. One should call Set method for keys one wants to keep for a specific time. The deletion process is triggered by a timer set to `Interval` value. It removes items from the oldest to the newest until we have less than `keep` items.
func NewDeleter ¶
func NewDeleter(name string, del DeleteHook, maxAge, runInterval time.Duration, bufSize, keep int, logger logrus.FieldLogger) *Deleter
type DeleterProvider ¶
type DeleterProvider func(name string, hook DeleteHook) *Deleter
func NewDeleterProvider ¶
func NewDeleterProvider(maxAge, interval time.Duration, bufSize, keep int) DeleterProvider
type SetCallback ¶
Click to show internal directories.
Click to hide internal directories.