recommender

package
v0.0.0-...-6b2d771 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachingRecommender

type CachingRecommender interface {
	// Get returns VPA recommendation for given pod
	Get(spec *apiv1.PodSpec) (*apimock.Recommendation, error)
}

CachingRecommender provides VPA recommendations for pods. VPA responses are cached.

func NewCachingRecommender

func NewCachingRecommender(ttl time.Duration, api apimock.RecommenderAPI) CachingRecommender

NewCachingRecommender creates CachingRecommender with given cache TTL

type TTLCache

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

TTLCache represents cache with ttl

func NewTTLCache

func NewTTLCache(ttl time.Duration) *TTLCache

NewTTLCache reates TTLCache for given TTL

func (*TTLCache) Get

func (c *TTLCache) Get(cacheKey *string) interface{}

Get Returns value present in cache for given cache key, or nil if key is not found or value TTL has expired.

func (*TTLCache) Set

func (c *TTLCache) Set(cacheKey *string, value interface{})

Set adds given value for given key

func (*TTLCache) StartCacheGC

func (c *TTLCache) StartCacheGC(interval time.Duration)

StartCacheGC starts background garbage collector worker which on every time interval removes expired cache entries If StartCacheGC was called, in order to properly remove cache object, call StopCacheGC. Otherwise TTLCache will never be garbage collected since background worker holds reference to it.

func (*TTLCache) StopCacheGC

func (c *TTLCache) StopCacheGC()

StopCacheGC stops background cache garbage collector

Jump to

Keyboard shortcuts

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