tracking

package
v0.0.0-...-2831398 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2018 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is a connection-tracking table. It lazily evicts entries when the backend becomes unhealthy or when the entry expires by not been accessed.

Cache is not thread-safe.

func New

func New(
	miss func(uint64) (*common.Backend, bool),
	expiry time.Duration,
) *Cache

New constructs a new connection-tracking table which caches the given function.

func (*Cache) Lookup

func (c *Cache) Lookup(key uint64) (*common.Backend, bool)

Lookup returns the backend associated with the given key. If the cached backend is unhealthy, or the key is not cached, it retrieves a backend from the underlying function. Lookup returns false if no backend is available.

Jump to

Keyboard shortcuts

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