cached

package
v0.0.0-...-11fc026 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackgroundAPI

type BackgroundAPI interface {
	metadata.MetricAPI
	// GetBackgroundAction returns a function to be called to execute a background cache update.
	GetBackgroundAction() func(metadata.Context) error
	// CurrentLiveRequests returns the number of requests currently in the queue
	CurrentLiveRequests() int
	// MaximumLiveRequests returns the maximum number of requests that can be in the queue
	MaximumLiveRequests() int
}

BackgroundAPI is a MetadataAPI that also supports background cache updates.

func NewMetricMetadataAPI

func NewMetricMetadataAPI(apiInstance metadata.MetricAPI, config Config) BackgroundAPI

NewMetricMetadataAPI creates a cached API given configuration and an underlying API object.

type Config

type Config struct {
	Freshness    time.Duration
	RequestLimit int
	TimeToLive   time.Duration
}

Config stores data needed to instantiate a CachedMetricMetadataAPI.

type TagSetList

type TagSetList struct {
	TagSets []api.TagSet // The tagsets for this metric
	Expiry  time.Time    // The time at which the cache entry expires
	Stale   time.Time    // The time at which the cache entry becomes stale

	sync.Mutex // Synchronizing mutex
	// contains filtered or unexported fields
}

TagSetList is an item in the cache.

Jump to

Keyboard shortcuts

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