cache

package
v2.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cache provides facilities to speed up access to the storage backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCachedBlobStatter added in v2.1.0

NewCachedBlobStatter creates a new statter which prefers a cache and falls back to a backend.

func NewCachedBlobStatterWithMetrics added in v2.1.0

func NewCachedBlobStatterWithMetrics(cache distribution.BlobDescriptorService, backend distribution.BlobDescriptorService, tracker MetricsTracker) distribution.BlobStatter

NewCachedBlobStatterWithMetrics creates a new statter which prefers a cache and falls back to a backend. Hits and misses will send to the tracker.

func ValidateDescriptor added in v2.1.0

func ValidateDescriptor(desc distribution.Descriptor) error

ValidateDescriptor provides a helper function to ensure that caches have common criteria for admitting descriptors.

Types

type BlobDescriptorCacheProvider added in v2.1.0

type BlobDescriptorCacheProvider interface {
	distribution.BlobDescriptorService

	RepositoryScoped(repo string) (distribution.BlobDescriptorService, error)
}

BlobDescriptorCacheProvider provides repository scoped BlobDescriptorService cache instances and a global descriptor cache.

type Logger added in v2.7.0

type Logger interface {
	Errorf(format string, args ...interface{})
}

Logger can be provided on the MetricsTracker to log errors.

Usually, this is just a proxy to dcontext.GetLogger.

type Metrics added in v2.1.0

type Metrics struct {
	Requests uint64
	Hits     uint64
	Misses   uint64
}

Metrics is used to hold metric counters related to the number of times a cache was hit or missed.

type MetricsTracker added in v2.1.0

type MetricsTracker interface {
	Hit()
	Miss()
	Metrics() Metrics
	Logger(context.Context) Logger
}

MetricsTracker represents a metric tracker which simply counts the number of hits and misses.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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