Documentation
¶
Overview ¶
Package cache defines supported-adapter cache contracts for generated services.
Store is the minimal get/set/delete interface implemented by adapters such as cacheredis. ValidateKey and CloneBytes provide shared behavior for key validation and defensive byte-slice handling, and cachetest contains the adapter contract suite.
The package does not choose eviction, tenancy, serialization, or Redis key layout. Callers and adapters must keep cache keys service-scoped and avoid embedding secrets or raw personal data in keys.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidKey = errors.New("cache key is required")
ErrInvalidKey is returned when a cache key is empty after trimming space.
Functions ¶
func CloneBytes ¶
CloneBytes returns a defensive copy of value.
func ValidateKey ¶
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.