Documentation
¶
Overview ¶
Package cache provides per-file caching for graph extraction results. Cache keys are based on SHA256 hashes of file content, so cached results are automatically invalidated when files change.
Index ¶
- type Cache
- func (c *Cache) CheckMultiple(baseDir string, paths []string) (cached, uncached []CheckResult)
- func (c *Cache) Clear() error
- func (c *Cache) Get(path, relPath string) (*CachedExtraction, bool)
- func (c *Cache) Hash(path string) (string, error)
- func (c *Cache) Init() error
- func (c *Cache) Set(path, relPath string, nodes []*graph.Node, edges []*graph.Edge) error
- func (c *Cache) Size() (int, error)
- type CacheStats
- type CachedExtraction
- type CheckResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// Dir is the cache directory (typically .graphize/cache/).
Dir string
}
Cache manages per-file extraction caches.
func New ¶
New creates a new cache instance. graphDir should be the root graph directory (e.g., ".graphize").
func (*Cache) CheckMultiple ¶
func (c *Cache) CheckMultiple(baseDir string, paths []string) (cached, uncached []CheckResult)
CheckMultiple checks multiple files against the cache. Returns separate lists of cached and uncached files.
func (*Cache) Get ¶
func (c *Cache) Get(path, relPath string) (*CachedExtraction, bool)
Get retrieves a cached extraction for a file path. Returns nil, false if not cached or if the file has changed.
type CacheStats ¶
CacheStats tracks cache hit/miss statistics.
type CachedExtraction ¶
type CachedExtraction struct {
// FileHash is the SHA256 hash of the file content.
FileHash string `json:"file_hash"`
// FilePath is the relative path of the source file.
FilePath string `json:"file_path"`
// Nodes extracted from this file.
Nodes []*graph.Node `json:"nodes"`
// Edges extracted from this file.
Edges []*graph.Edge `json:"edges"`
}
CachedExtraction stores the extraction results for a single file.
type CheckResult ¶
type CheckResult struct {
Path string
RelPath string
Cached bool
Entry *CachedExtraction
}
CheckResult contains the result of checking a file against the cache.