kubernetesk8s.io/kubernetes/pkg/util/cache Index | Files

package cache

import "k8s.io/kubernetes/pkg/util/cache"

Index

Types

type Cache

type Cache []*cacheShard

func NewCache

func NewCache(maxSize int) Cache

func (*Cache) Add

func (c *Cache) Add(index uint64, obj interface{}) bool

Returns true if object already existed, false otherwise.

func (*Cache) Get

func (c *Cache) Get(index uint64) (obj interface{}, found bool)

type Clock

type Clock interface {
	Now() time.Time
}

Clock defines an interface for obtaining the current time

type LRUExpireCache

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

func NewLRUExpireCache

func NewLRUExpireCache(maxSize int) *LRUExpireCache

NewLRUExpireCache creates an expiring cache with the given size

func NewLRUExpireCacheWithClock

func NewLRUExpireCacheWithClock(maxSize int, clock Clock) *LRUExpireCache

NewLRUExpireCache creates an expiring cache with the given size, using the specified clock to obtain the current time

func (*LRUExpireCache) Add

func (c *LRUExpireCache) Add(key lru.Key, value interface{}, ttl time.Duration)

func (*LRUExpireCache) Get

func (c *LRUExpireCache) Get(key lru.Key) (interface{}, bool)

Source Files

cache.go lruexpirecache.go

Version
v1.5.7
Published
Apr 27, 2017
Platform
windows/amd64
Imports
3 packages
Last checked
11 seconds ago

Tools for package owners.