expirationwatch

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2019 License: Apache-2.0 Imports: 6 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(expirationBuffer time.Duration) *Watcher

New instantiates a new expiration watcher. An expiration buffer (positive or negative) can be specified, causing items to be deemed expired some time before or after their expiration reaches current UTC time. A positive expirationBuffer will make the item expire sooner then UTC, and a negative buffer after.

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) Receive

func (w *Watcher) Receive() <-chan []ExpiredItem

Receive returns a read-only channel that can be used to listen for expired items

func (*Watcher) Remove

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

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

func (*Watcher) Start

func (w *Watcher) Start(pollingInterval time.Duration) error

Start starts the expiration watchers poller

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop stops the expiration watchers poller

Jump to

Keyboard shortcuts

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