expiration

package
v0.0.0-...-0101299 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const (
	TTLKeyName = "expiration"
)

Variables

This section is empty.

Functions

func CreateTwigTTL

func CreateTwigTTL(ttl time.Duration) (twig.Key, []byte, error)

func ExpirationData

func ExpirationData(node forest.Node) (hasExpired, canExpire bool, err error)

ExpirationData checks for the presence of an expiration metadata extension as well as whether the node has expired. The first return value will be true if the node has a set expiration in the past. The second return value will be true if there is an expiration date set. Any errors in parsing the data will be returned as the final value.

func ExpiresAt

func ExpiresAt(node forest.Node) (time.Time, error)

ExpiresAt returns the time at which the node expires, if any. If no expiration date is set, it will return the zero value for a time.Time.

func IsExpired

func IsExpired(node forest.Node) (bool, error)

IsExpired checks whether the node has an expiration set in its twig metadata and, if so, whether the node has expired.

func TTLKey

func TTLKey() twig.Key

func UnmarshalTTL

func UnmarshalTTL(data []byte) (time.Time, error)

Types

type ExpiredPurger

type ExpiredPurger struct {
	PurgeInterval time.Duration
	store.ExtendedStore
	*log.Logger
}

ExpiredPurger provides automation to periodically remove expired nodes from a store.

func (ExpiredPurger) Start

func (e ExpiredPurger) Start(done <-chan struct{})

Start launches the ExpiredPurger. It will perform an immediate purge, and then will do anther after each e.PurgeInterval. It will shut down when the done channel closes.

Jump to

Keyboard shortcuts

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