cache

package module
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 1 Imported by: 0

README

gas/cache

Test Go Reference Go Version License

Part of the Gas monorepo · Documentation · All modules

Key-value caching for the Gas framework, with two interchangeable backends: in-memory for development, Valkey (Redis-compatible) for production.

Implements gas.CacheProvider.

go get github.com/gasmod/gas/cache
gas.WithSingletonService[gas.CacheProvider](cachemem.New()),

Both backends need gas.ConfigProvider and gas.Logger.

Package Use case
cache/memory Development, testing, single-instance deployments
cache/valkey Production, multi-instance deployments
cache/cachetest Recording mock of gas.CacheProvider

Documentation

The full guide, with configuration, testing, and worked examples, is on the docs site. This README is deliberately a signpost: keeping a second copy here is how the docs drifted before.

License

MIT

Documentation

Overview

Package cache provides the caching service for the Gas ecosystem with in-memory and Valkey (Redis-compatible) backends. Concrete implementations live in the memory and valkey sub-packages.

See the module README for usage examples and design rationale.

SPDX-License-Identifier: MIT

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound is returned by Get when the requested key does not
	// exist or has expired.
	ErrKeyNotFound = errors.New("cache: key not found")

	// ErrClosed is returned when an operation is attempted on a closed
	// cache service.
	ErrClosed = errors.New("cache: service is closed")
)

Sentinel errors returned by CacheProvider implementations.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
Package cachetest provides a mock implementation of gas.CacheProvider for use in tests.
Package cachetest provides a mock implementation of gas.CacheProvider for use in tests.

Jump to

Keyboard shortcuts

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