cache

package
v0.74.7 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheConfig

type CacheConfig struct {
	// MaxSize is the maximum number of items in the cache.
	MaxSize int
	// DefaultTTL is the default time-to-live for cache entries.
	DefaultTTL time.Duration
}

CacheConfig configures the cache layer.

func DefaultCacheConfig

func DefaultCacheConfig() CacheConfig

DefaultCacheConfig returns sensible defaults.

type CacheLayer

type CacheLayer struct {
	// contains filtered or unexported fields
}

CacheLayer implements a thread-safe cache with TTL expiration and LRU eviction. It follows the cache-aside pattern: callers check the cache first, then fall back to the source of truth and populate the cache on miss.

func