Documentation
¶
Index ¶
- func HashContent(content []byte) string
- type Cache
- func (c *Cache) Clear()
- func (c *Cache) Clone() *Cache
- func (c *Cache) Entries() int
- func (c *Cache) GetHash(path string) string
- func (c *Cache) HasChanged(path, currentHash string) bool
- func (c *Cache) InvalidatedByDirectoryData(dirPath string) []string
- func (c *Cache) InvalidatedByGlobalData() []string
- func (c *Cache) InvalidatedPages(changedTemplate string) []string
- func (c *Cache) IsConfigChanged(configHash string) bool
- func (c *Cache) SetHash(path, hash string)
- func (c *Cache) ShouldSkipFile(path string, currentContent []byte) bool
- func (c *Cache) TrackDirectoryData(pagePath, dirPath string)
- func (c *Cache) TrackTemplateUsage(pagePath, templatePath string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashContent ¶
HashContent computes a SHA-256 hex digest of the given content bytes.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache manages content hashes and template usage tracking for incremental build detection. Passed in-memory between builds.
func (*Cache) Clear ¶
func (c *Cache) Clear()
Clear removes all stored hashes and template tracking data.
func (*Cache) Clone ¶
Clone returns a deep copy of the cache. Used by BuildIncremental to carry forward hashes for unchanged pages without re-hashing them.
func (*Cache) GetHash ¶
GetHash retrieves the stored content hash for a source file path. Returns empty string if no hash is stored.
func (*Cache) HasChanged ¶
HasChanged returns true if the given hash differs from the stored hash for the path (or if no hash is stored). Used during rebuild to decide whether a file needs re-processing.
func (*Cache) InvalidatedByDirectoryData ¶
InvalidatedByDirectoryData returns page paths that need rebuilding when a directory's _data.yaml changes. Only pages in that directory are affected.
func (*Cache) InvalidatedByGlobalData ¶
InvalidatedByGlobalData returns all page paths that need rebuilding when global data (data/ directory files) changes.
func (*Cache) InvalidatedPages ¶
InvalidatedPages returns the list of page paths that need rebuilding because the given template changed. Returns nil if the template is not tracked.
func (*Cache) IsConfigChanged ¶
IsConfigChanged returns true if the config hash differs from the stored hash. A config change triggers a full rebuild of all pages.
func (*Cache) ShouldSkipFile ¶
ShouldSkipFile returns true if the file content hash matches the stored hash, meaning the file has not changed and can be skipped entirely (no re-parse, no re-render).
func (*Cache) TrackDirectoryData ¶
TrackDirectoryData records that pages in a directory depend on that directory's _data.yaml.
func (*Cache) TrackTemplateUsage ¶
TrackTemplateUsage records that a page uses a specific template. Called during layout resolution to build the invalidation map.