Documentation
¶
Overview ¶
Package cache provides tool result caching for LLM agent tool execution.
It defines the ToolCache interface, an in-memory LRU backend (LRUCache), a CachedTool decorator wrapping tools.Tool, and helpers for deterministic cache key generation and cache policy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheCountersFromTool ¶
CacheCountersFromTool extracts cache counters from a Tool wrapped by WrapTool. Returns (0, 0, false) if the tool is not cached.
Types ¶
type CachePolicy ¶
CachePolicy determines whether a tool result should be cached. Return false to prevent caching (e.g., error results, non-deterministic tools).
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache is an in-memory LRU cache with per-entry TTL.
func NewLRUCache ¶
NewLRUCache creates a new LRU cache with the given max size. If maxSize <= 0, defaults to 1000.