Documentation
¶
Overview ¶
Package cache provides caching for parsed Buildfiles.
The cache stores parsed AST keyed by absolute file path. Cache entries are invalidated when the file's modification time changes. This avoids re-parsing unchanged Buildfiles on subsequent builds.
Cache invalidation strategy:
- Store file mtime with each entry
- On lookup, compare current mtime with stored mtime
- If different, invalidate and return cache miss
The cache is not persistent across process invocations. A future version may add disk-based persistence.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutodepsCache ¶
type AutodepsCache struct {
// contains filtered or unexported fields
}
AutodepsCache caches parsed .d file contents keyed by absolute path. Cache entries are invalidated when the file's mtime changes.
func NewAutodepsCache ¶
func NewAutodepsCache() *AutodepsCache
NewAutodepsCache creates an empty autodeps cache.
func (*AutodepsCache) Clear ¶
func (c *AutodepsCache) Clear()
Clear removes all entries from the cache.
func (*AutodepsCache) Get ¶
func (c *AutodepsCache) Get(path string) ([]string, bool, error)
Get retrieves cached dependencies for a file. Returns (nil, false, nil) on cache miss. Returns (nil, false, nil) if file has been modified since caching. Returns (nil, false, nil) if file no longer exists. Returns (deps, true, nil) on cache hit.
func (*AutodepsCache) Invalidate ¶
func (c *AutodepsCache) Invalidate(path string)
Invalidate removes a specific entry from the cache.
func (*AutodepsCache) Put ¶
func (c *AutodepsCache) Put(path string, deps []string) error
Put stores parsed dependencies for a file in the cache. The file's current modification time is recorded for invalidation. Returns an error if the file cannot be stat'd.
func (*AutodepsCache) Size ¶
func (c *AutodepsCache) Size() int
Size returns the number of entries in the cache.
type BuildfileCache ¶
type BuildfileCache struct {
// contains filtered or unexported fields
}
BuildfileCache caches parsed Buildfile ASTs keyed by absolute path. Cache entries are invalidated when the file's mtime changes.
func NewBuildfileCache ¶
func NewBuildfileCache() *BuildfileCache
NewBuildfileCache creates an empty cache.
func (*BuildfileCache) Clear ¶
func (c *BuildfileCache) Clear()
Clear removes all entries from the cache.
func (*BuildfileCache) Get ¶
Get retrieves cached statements for a file. Returns (nil, false, nil) on cache miss. Returns (nil, false, nil) if file has been modified since caching. Returns (nil, false, nil) if file no longer exists. Returns (statements, true, nil) on cache hit.
func (*BuildfileCache) Invalidate ¶
func (c *BuildfileCache) Invalidate(path string)
Invalidate removes a specific entry from the cache.
func (*BuildfileCache) Put ¶
func (c *BuildfileCache) Put(path string, statements []ast.Statement) error
Put stores parsed statements for a file in the cache. The file's current modification time is recorded for invalidation. Returns an error if the file cannot be stat'd.
func (*BuildfileCache) Size ¶
func (c *BuildfileCache) Size() int
Size returns the number of entries in the cache.