expirationwatch

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 5 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpiredItem

type ExpiredItem struct {
	ExpirationTimestamp time.Time
	ID                  string
}

ExpiredItem represents an expired item returned from the Watcher

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher watches the expiration of items

func New

func New() *Watcher

New instantiates a new expiration watcher

func (*Watcher) Add

func (w *Watcher) Add(expirationTimestamp time.Time, id string)

Add adds a new item identified by an ID to the expiration watcher

func (*Watcher) Prune

func (w *Watcher) Prune(timestamp time.Time) []ExpiredItem

Prune checks for any expired items given a timestamp and removes any expired items from the expiration watcher and returns them to the caller

func (*Watcher) Remove

func (w *Watcher) Remove(expirationTimestamp time.Time, id string)

Remove removes the item with a specified id from the expiration watcher

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL