Documentation
¶
Overview ¶
Package cache provides in-memory caches for parsed ASTs and LLM responses.
Both caches use LRU eviction and are safe for concurrent access.
Index ¶
Constants ¶
const ( DefaultParseCacheSize = 5000 DefaultLLMCacheSize = 500 DefaultLLMTTL = time.Hour )
Default cache sizes.
Variables ¶
This section is empty.
Functions ¶
func PromptHash ¶
PromptHash computes the FNV-1a hash of system + user prompt pair.
Types ¶
type LLMCache ¶
type LLMCache struct {
// contains filtered or unexported fields
}
LLMCache caches LLM completion responses keyed by FNV-1a hash of prompts.
func NewLLMCache ¶
NewLLMCache creates an LLM response cache with the given size and TTL.
type ParseCache ¶
type ParseCache struct {
// contains filtered or unexported fields
}
ParseCache caches tree-sitter parse results keyed by absolute file path.
func NewParseCache ¶
func NewParseCache(maxSize int) *ParseCache
NewParseCache creates a parse cache with the given maximum entry count.
func (*ParseCache) Get ¶
func (c *ParseCache) Get(path string, modTime int64, size int64) *parser.ParseResult
Get returns a cached parse result if the file hasn't changed. Returns nil if not cached or stale (modTime/size mismatch).
func (*ParseCache) Put ¶
func (c *ParseCache) Put(path string, modTime int64, size int64, result *parser.ParseResult)
Put stores a parse result. Evicts the least-recently-used entry if at capacity.
func (*ParseCache) Stats ¶
func (c *ParseCache) Stats() Stats
Stats returns current cache statistics.