NaifyView\Compiler\CompiledArtifactCacheProbe クラス
CompiledArtifactCacheProbe — compiled mainline の Compiled Artifact Cache Probe
template を generated PHP class へ落とす compile pipeline の一部。 大きな compiler へ責務を押し込まず、source 生成・依存計画・fast path などを小さく分ける。
使用例
// Engine が warm-hit できない template を compiled artifact へ変換する時に使う。
// 通常は View / Engine 経由で呼ばれ、アプリ側から直接操作しない。
プロパティ
| 名前 | 型 | 説明 |
|---|---|---|
private
static
$templateSignatureMemo
|
array |
request-local template stat/signature memo |
private
static
$templateStatSnapshotMemo
|
array |
request-local template stat memo without content hash |
private
static
$displayTemplatePathResolveMemo
|
array |
request-local display-path resolve memo |
private
$compilerVersion
|
string |
generated class compiler version contract |
private
$cacheStore
|
CompiledArtifactCacheStore |
compiled artifact cache filesystem owner |
private
$templateRoots
|
array |
root-aware display path 用 template roots |
private
$compileLevel
|
string |
generated PHP readability / exposure level |
private
$templateRecursionLimit
|
int |
generated class template recursion limit contract |
private
$compileContractHash
|
string |
delimiters / roots / escape 設定を含む compile contract hash |
メソッド
| メソッド | 説明 |
|---|---|
public
__construct(string $compilerVersion, CompiledArtifactCacheStore $cacheStore, array $templateRoots = '...', string $compileLevel = debug, int $templateRecursionLimit = 8, string $compileContractHash = ): void
|
インスタンスを初期化する |
public
static
clearProcessCaches(): void
|
process 単位で持っている compiled artifact probe cache をクリアする |
public
buildCompiledArtifactCacheDescriptor(string $resolvedPath, string $mode): array
|
`buildCompiledArtifactCacheDescriptor()` を実行する |
public
applyDependencyAwareIdentity(array $cacheDescriptor, ?string $dependencyFreshnessHash): array
|
descriptor の class identity(name / file path / key)に dependency freshness hash を織り込む
親テンプレ自身の signature しか持たない base identity だと、include/layout など 依存だけが変わったとき class 名が不変になり、同一プロセスで `class_exists()` 経由の stale class 再利用が起きる。dependency freshness hash を effective hash に混ぜることで、 依存が変われば別の class 名 / 別ファイルになり、in-process でも fresh にロードし直せる。 依存ハッシュが未確定(null/空)の場合は base のまま返す(初回 compile / 旧 meta 互換)。 template_signature / template_key / meta_file_path は変えない(freshness 判定の土台は不変)。 |
public
resolveGeneratedClassFreshness(?array $meta, array $cacheDescriptor, string $mode): array
|
`resolveGeneratedClassFreshness()` を実行する |
public
buildDependencyFreshnessMetadata(array $templatePaths): array
|
`buildDependencyFreshnessMetadata()` を実行する |
private
readTemplateSignature(string $resolvedPath): array
|
`readTemplateSignature()` を実行する |
private
readTemplateStatSnapshot(string $resolvedPath): array
|
content hash を読まずに template の stat snapshot だけを返す |
private
resolveDependencyFreshness(array $meta, array $cacheDescriptor): array
|
`resolveDependencyFreshness()` を実行する |
private
buildDependencyFreshnessMetadataFromDisplayPaths(array $displayTemplatePaths, array $cacheDescriptor, array $resolvedPathMap = '...'): array
|
`buildDependencyFreshnessMetadataFromDisplayPaths()` を実行する |
private
resolveDependencyStatSnapshotFreshness(array $displayTemplatePaths, array $expectedSignatures, array $cacheDescriptor, array $resolvedPathMap, int $expectedCount): ?array
|
metadata に保存済みの mtime/size snapshot だけで dependency freshness を判定する。
stat が不一致なら早期に stale と判定する。一致時も後段の content hash 照合を行い、 mtime/size を維持したまま内容だけ更新された dependency を見落とさない。 snapshot が壊れている場合は stat 判定を使わず、後段の content hash 照合へ進める。 |
private
resolveDisplayTemplatePath(string $displayTemplatePath): ?string
|
`resolveDisplayTemplatePath()` を実行する |
private
buildDisplayTemplatePathResolveMemoKey(string $displayTemplatePath): string
|
`buildDisplayTemplatePathResolveMemoKey()` を実行する |
private
normalizeTemplatePaths(array $templatePaths): array
|
`normalizeTemplatePaths()` を実行する |
private
isDisplayTemplatePath(string $templatePath): bool
|
`isDisplayTemplatePath()` かを返す |
private
buildSafeCacheName(string $resolvedPath): string
|
`buildSafeCacheName()` を実行する |
private
buildTemplateDisplayPath(string $resolvedPath): string
|
`buildTemplateDisplayPath()` を実行する |
private
normalizeTemplateRoots(array $templateRoots): array
|
`normalizeTemplateRoots()` を実行する |
private
buildClassName(string $templateKeyHash, string $signatureHash): string
|
`buildClassName()` を実行する |
private
normalizeCompileLevel(string $compileLevel): string
|
`normalizeCompileLevel()` を実行する |