struct

Hwaro::Core::Build::CacheEntry

Inherits JSON::Serializable < Struct < Value < Object

Represents a cached entry for a file

Constructors

new(path : String, mtime : Int64, hash : String, output_path : String, size : Int64 = -1_i64, template_hash : String = "", config_hash : String = "", cascade_hash : String = "", output_paths : Array(String) = [] of String, assets_hash : String = "", git_hash : String = "", derived_paths : Array(String) = [] of String, relations_hash : String = "")
Source
new(pull : JSON::PullParser)

Allow missing fields when deserializing legacy entries

Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

assets_hash

Fingerprint of the page bundle's colocated asset names (sorted, length-prefixed) as of the build that wrote this entry. Adding or removing a bundle asset changes what page.assets renders without touching the page's own source, so it must be part of the cache key. "" for pages with no assets AND for entries written before this field existed — asset-carrying pages rebuild once when upgrading from a legacy cache, asset-less pages don't.

Source
assets_hash=(assets_hash : String)

Fingerprint of the page bundle's colocated asset names (sorted, length-prefixed) as of the build that wrote this entry. Adding or removing a bundle asset changes what page.assets renders without touching the page's own source, so it must be part of the cache key. "" for pages with no assets AND for entries written before this field existed — asset-carrying pages rebuild once when upgrading from a legacy cache, asset-less pages don't.

Source
cascade_hash

Fingerprint of the merged section [cascade] values that applied to this page when it was built. A parent _index.md cascade edit changes the fingerprint and invalidates the page even though its own source file is untouched.

Source
cascade_hash=(cascade_hash : String)

Fingerprint of the merged section [cascade] values that applied to this page when it was built. A parent _index.md cascade edit changes the fingerprint and invalidates the page even though its own source file is untouched.

Source
config_hash
Source
config_hash=(config_hash : String)
Source
derived_paths

Files this page produced that are NOT its own output: its aliases redirect stubs and, for a section, its /page/N/ pagination pages. Kept apart from output_paths on purpose — that list also feeds changed? ("a manually deleted sibling forces a rebuild"), and the page count a section paginates into is only known AFTER rendering, so it cannot take part in the decision to render. These paths exist solely so a page that goes away, or stops producing one of them, takes the file with it. Empty for entries written before this field.

Source
derived_paths=(derived_paths : Array(String))

Files this page produced that are NOT its own output: its aliases redirect stubs and, for a section, its /page/N/ pagination pages. Kept apart from output_paths on purpose — that list also feeds changed? ("a manually deleted sibling forces a rebuild"), and the page count a section paginates into is only known AFTER rendering, so it cannot take part in the decision to render. These paths exist solely so a page that goes away, or stops producing one of them, takes the file with it. Empty for entries written before this field.

Source
git_hash

Fingerprint of the page's git metadata (latest commit hash, lastmod, first_commit — see Render#page_git_hash) as of the build that wrote this entry. With [git] enabled a new commit to an unedited file changes page.updated/page.git and therefore the rendered output even though the source bytes are unchanged, so it must be part of the cache key. "" when the feature is off or the file has no history, AND for legacy entries — so a disabled site never rebuilds because of this field.

Source
git_hash=(git_hash : String)

Fingerprint of the page's git metadata (latest commit hash, lastmod, first_commit — see Render#page_git_hash) as of the build that wrote this entry. With [git] enabled a new commit to an unedited file changes page.updated/page.git and therefore the rendered output even though the source bytes are unchanged, so it must be part of the cache key. "" when the feature is off or the file has no history, AND for legacy entries — so a disabled site never rebuilds because of this field.

Source
hash

Generates an UInt64 hash value for this object.

This method must have the property that a == b implies a.hash == b.hash.

The hash value is used along with == by the Hash class to determine if two objects reference the same hash key.

Subclasses must not override this method. Instead, they must define hash(hasher), though usually the macro def_hash can be used to generate this method.

Source
hash=(hash : String)
Source
mtime
Source
mtime=(mtime : Int64)
Source
output_path
Source
output_path=(output_path : String)
Source
output_paths

Secondary sibling output files this page emitted beyond output_path (e.g. index.json, index.xml — see [outputs]). Empty for pages with no extra formats and for every entry written before this feature existed (legacy cache JSON loads with []).

Source
output_paths=(output_paths : Array(String))

Secondary sibling output files this page emitted beyond output_path (e.g. index.json, index.xml — see [outputs]). Empty for pages with no extra formats and for every entry written before this feature existed (legacy cache JSON loads with []).

Source
path
Source
path=(path : String)
Source
relations_hash

Fingerprint of what this page renders from OTHER pages, one by one: its prev/next neighbours, series, related posts, translations and ancestors (when its templates read them), the pages it fetches with a literal get_page(path=...), and the URLs its @/ links resolve to. None of those move this page's own source, and none of them are a listing the global page-set fingerprint gates, so retitling a post left its neighbours' "next: …" link — and every @/ link to a renamed page — stale on warm builds. "" when the page reads none of them, and for legacy entries: a page that reads none never rebuilds because of this field, while every page that does re-renders once on the first warm build after upgrading (its legacy "" no longer matches).

Source
relations_hash=(relations_hash : String)

Fingerprint of what this page renders from OTHER pages, one by one: its prev/next neighbours, series, related posts, translations and ancestors (when its templates read them), the pages it fetches with a literal get_page(path=...), and the URLs its @/ links resolve to. None of those move this page's own source, and none of them are a listing the global page-set fingerprint gates, so retitling a post left its neighbours' "next: …" link — and every @/ link to a renamed page — stale on warm builds. "" when the page reads none of them, and for legacy entries: a page that reads none never rebuilds because of this field, while every page that does re-renders once on the first warm build after upgrading (its legacy "" no longer matches).

Source
size

Source size alongside the mtime: a tool that restores mtimes (rsync -t, tar) can bring back the old mtime with new bytes, and a size change then still re-hashes the file. -1 (unknown) for entries written before this field: only their mtime is compared.

Source
size=(size : Int64)

Source size alongside the mtime: a tool that restores mtimes (rsync -t, tar) can bring back the old mtime with new bytes, and a size change then still re-hashes the file. -1 (unknown) for entries written before this field: only their mtime is compared.

Source
template_hash
Source
template_hash=(template_hash : String)
Source