cache

package
v1.0.1-0...-e82b9d2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cache defines an optional, backend-neutral byte cache capability. Callers own key construction, scope, and authorization policy. Cache and Provider values are borrowed from composition; callers must not close them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(ctx context.Context, key string) (value []byte, found bool, err error)
	Put(ctx context.Context, key string, value []byte, ttl time.Duration) error
	Delete(ctx context.Context, key string) error
}

Cache stores opaque bytes. A Get miss returns found=false and a nil error. Implementations must not expose mutable storage through Put or Get. A positive TTL expires an entry; zero means no expiry.

type Provider

type Provider interface {
	Cache(ctx context.Context, name string) (Cache, error)
}

Provider resolves exactly the named, explicitly registered cache. Empty or unknown names fail; resolution does not create a backend.

Jump to

Keyboard shortcuts

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