cache

package
v2.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound       = errors.New("cache not found")
	ErrInvalidTTL     = errors.New("invalid TTL provided")
	ErrAddFailed      = errors.New("failed to add key/value to cache")
	ErrInvalidMaxSize = errors.New("invalid max size provided for cache")
)

Functions

This section is empty.

Types

type Cache

type Cache[T any] interface {
	// Get returns the value associated with the key, or an error if not found.
	Get(ctx context.Context, key string) (T, error)

	// Set stores a value with the specified key.
	Set(ctx context.Context, key string, value T, ttl time.Duration) error

	// Delete removes the specified key/value from the cache.
	Delete(ctx context.Context, key string) error
}

Cache is the main interface for a generic key-value cache.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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