final class ApplicationConfigCache (View source)

Persists compiled configuration as authenticated data below private application storage.

Cache contents are never executed or passed to PHP deserialization. Invalid authenticated data is treated as a miss, while an unsafe filesystem boundary fails explicitly.

Constants

private CACHE_VERSION

private KEY_BYTES

private CREATE_ATTEMPTS

private DEFAULT_MAX_FILE_BYTES

private DEFAULT_MAX_DATA_DEPTH

private DEFAULT_MAX_DATA_NODES

private CACHE_DIRECTORY

private KEY_DIRECTORY

private KEY_FILE

private KEY_INFO

Methods

__construct(int $maxFileBytes = self::DEFAULT_MAX_FILE_BYTES, int $maxDataDepth = self::DEFAULT_MAX_DATA_DEPTH, int $maxDataNodes = self::DEFAULT_MAX_DATA_NODES)

Configures defensive limits for the generated cache without requiring application settings.

array|null
loadIfFresh(ApplicationContext $context, string $entrypoint)

Returns hydrated definitions only when the authenticated cache and all tracked inputs are fresh.

array|null
void
write(ApplicationContext $context, string $entrypoint, array $definitions, array $sourceFiles, array $envKeys)

Atomically publishes an authenticated snapshot of definitions and their freshness metadata.

void

Details

__construct

__construct(int $maxFileBytes = self::DEFAULT_MAX_FILE_BYTES, int $maxDataDepth = self::DEFAULT_MAX_DATA_DEPTH, int $maxDataNodes = self::DEFAULT_MAX_DATA_NODES)

Configures defensive limits for the generated cache without requiring application settings.

Parameters

int $maxFileBytes
int $maxDataDepth
int $maxDataNodes

Exceptions

ApplicationConfigCacheException

loadIfFresh

array|null loadIfFresh(ApplicationContext $context, string $entrypoint)

Returns hydrated definitions only when the authenticated cache and all tracked inputs are fresh.

Corrupted, modified, unsupported, or stale data produces a cache miss without invoking a cached class or executing cache contents.

Parameters

ApplicationContext $context
string $entrypoint

Return Value

array|null

Exceptions

ApplicationConfigCacheException

write

void write(ApplicationContext $context, string $entrypoint, array $definitions, array $sourceFiles, array $envKeys)

Atomically publishes an authenticated snapshot of definitions and their freshness metadata.

Parameters

ApplicationContext $context
string $entrypoint
array $definitions
array $sourceFiles
array $envKeys

Return Value

void

Exceptions

ApplicationConfigCacheException