cache

package
v0.0.0-...-f5949d8 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MutationCache

type MutationCache interface {
	GetByKey(key string) (interface{}, bool, error)
	ByIndex(indexName, indexKey string) ([]interface{}, error)
	Mutation(interface{})
}

MutationCache is able to take the result of update operations and stores them in an LRU that can be used to provide a more current view of a requested object. It requires interpreting resourceVersions for comparisons. Implementations must be thread-safe. TODO find a way to layer this into an informer/lister

func NewIntegerResourceVersionMutationCache

func NewIntegerResourceVersionMutationCache(keyFunc cache.KeyFunc, backingCache cache.Store, indexer cache.Indexer, ttl time.Duration, includeAdds bool) MutationCache

NewIntegerResourceVersionMutationCache returns a MutationCache that understands how to deal with objects that have a resource version that:

  • is an integer
  • increases when updated
  • is comparable across the same resource in a namespace

Most backends will have these semantics. Indexer may be nil. ttl controls how long an item remains in the mutation cache before it is removed.

If includeAdds is true, objects in the mutation cache will be returned even if they don't exist in the underlying store. This is only safe if your use of the cache can handle mutation entries remaining in the cache for up to ttl when mutations and deletes occur very closely in time.

type ResourceVersionComparator

type ResourceVersionComparator interface {
	CompareResourceVersion(lhs, rhs runtime.Object) int
}

ResourceVersionComparator is able to compare object versions.

Jump to

Keyboard shortcuts

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