internalversions

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AnyVersion is a special version number that can be used to
	// indicate that the version of a cache entry does not matter.
	// The Get function will return any cached value, regardless of
	// its version and will generate a new value if there is no cached
	// value.
	AnyVersion = CacheVersion{/* contains filtered or unexported fields */}
	// NonCachedVersion is a special version number that can be used to
	// indicate to the Get function that we want to generate a new value
	// and do not want to use any cached value.
	NonCachedVersion = CacheVersion{/* contains filtered or unexported fields */}
)

Functions

func IsNewerVersion

func IsNewerVersion(a, b CacheVersion) bool

Types

type AtomicLatestVersion

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

AtomicLatestVersion is a thread-safe version bookkeeper, which can be used to keep track of the latest version of a set of results. For example, if a piece of code performs 5 cache lookups, this AtomicLatestVersion can be used to keep track of the latest version of the results of those lookups and use that latest version as the version of the combined result. Then, the next time the code runs, it can invalidate all the cache lookups by specifying the latest version as the minimum version for each individual cache lookup. TODO: this mechanism might introduce some unnecessary cache invalidations.

func NewAtomicLatestVersion

func NewAtomicLatestVersion(rv CacheVersion) AtomicLatestVersion

func (*AtomicLatestVersion) Load

func (*AtomicLatestVersion) Update

func (r *AtomicLatestVersion) Update(rv CacheVersion)

type CacheVersion

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

CacheVersion is a version number that can be used to track the version of a cache entry. The version number is a monotonically increasing number that is globally unique across all caches and entries.

func NewGlobalVersion

func NewGlobalVersion() CacheVersion

func NextVersion

func NextVersion(rv CacheVersion) CacheVersion

Jump to

Keyboard shortcuts

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