cache

package
v3.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package cache defines supported contrib cache contracts for adapters.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKey = errors.New("cache key is required")

ErrInvalidKey is returned when a cache key is empty after trimming space.

Functions

func CloneBytes

func CloneBytes(value []byte) []byte

CloneBytes returns a defensive copy of value.

func ValidateKey

func ValidateKey(key string) error

ValidateKey validates an application-owned cache key.

Types

type Store

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

Store is the minimal cache contract used by contrib adapters and generated services.

Directories

Path Synopsis
Package cachetest provides reusable cache adapter contract tests.
Package cachetest provides reusable cache adapter contract tests.

Jump to

Keyboard shortcuts

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