cache

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

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

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

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