Documentation
¶
Index ¶
- func HashContent(content []byte) string
- type Cache
- func (c *Cache) Clear()
- func (c *Cache) ClearDependencies()
- func (c *Cache) ClearVirtualPages()
- 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) InvalidatedVirtualPages(changedFile string) []string
- func (c *Cache) IsConfigChanged(configHash string) bool
- func (c *Cache) PagesForDependency(depPath string) []string
- func (c *Cache) SetHash(path, hash string)
- func (c *Cache) ShouldSkipFile(path string, currentContent []byte) bool
- func (c *Cache) TrackDependency(pageRelPath, depPath string)
- func (c *Cache) TrackDirectoryData(pagePath, dirPath string)
- func (c *Cache) TrackTemplateUsage(pagePath, templatePath string)
- func (c *Cache) TrackVirtualDependency(virtualRelPath, sourcePath string)
- func (c *Cache) TrackVirtualPage(relPath string)
- func (c *Cache) UntrackPageDependencies(pageRelPath string)
- func (c *Cache) VirtualPagePaths() []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) ClearDependencies ¶ added in v0.6.0
func (c *Cache) ClearDependencies()
ClearDependencies resets all content page dependency tracking without affecting content hashes, template tracking, or virtual page tracking. Called before re-tracking dependencies on each build so stale entries from previous builds do not persist (issue #1100).
func (*Cache) ClearVirtualPages ¶ added in v0.5.0
func (c *Cache) ClearVirtualPages()
ClearVirtualPages removes all virtual page tracking and dependency tracking without affecting content hashes or template tracking. Called before re-populating virtual pages after each build so stale entries don't persist.
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) InvalidatedVirtualPages ¶ added in v0.5.0
InvalidatedVirtualPages returns the virtual page RelPaths that depend on the given source file. Returns nil if no virtual page tracks the given source file as a dependency (issue #1058).
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) PagesForDependency ¶ added in v0.6.0
PagesForDependency returns the content page RelPaths that depend on the given external file. Returns nil if no page tracks the given file as a dependency (issue #1100).
func (*Cache) SetHash ¶
SetHash records the content hash for a source file path. Empty keys are silently discarded — taxonomy pages have empty RelPath and the Build() hash loop would create a spurious entry.
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) TrackDependency ¶ added in v0.6.0
TrackDependency records that a content page depends on an external file. Builds a reverse map so PagesForDependency can return all pages affected by a source file change (issue #1100).
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.
func (*Cache) TrackVirtualDependency ¶ added in v0.5.0
TrackVirtualDependency records that a virtual page depends on a source file outside the content directory. Builds a reverse map so InvalidatedVirtualPages can return all virtual pages affected by a source file change (issue #1058).
func (*Cache) TrackVirtualPage ¶ added in v0.5.0
TrackVirtualPage records a RelPath as a virtual page injected by onPagesReady. Used by BuildIncremental to pre-populate renderRelPaths on the next rebuild so virtual pages aren't filtered out (issue #970).
func (*Cache) UntrackPageDependencies ¶ added in v0.6.0
UntrackPageDependencies removes a single page from every dependency set. Used by BuildIncremental to clear stale deps for pages being re-rendered without wiping deps for skipped pages (issue #1100).
func (*Cache) VirtualPagePaths ¶ added in v0.5.0
VirtualPagePaths returns all RelPaths tracked as virtual pages. Returns an empty (non-nil) slice when no virtual pages are tracked.