final class FileCacheItemPool implements CacheItemPoolInterface (View source)

internal  Resolve the configured pool through CacheItemPoolInterface so application path boundaries are supplied.
 

Persists PSR-6 values in authenticated, non-executable files below one private cache root.

Serialized PHP values are restored only after the complete envelope and its HMAC have been verified.

Constants

private FORMAT_VERSION

private DEFAULT_MAX_FILE_BYTES

private DEFAULT_MAX_SERIALIZATION_DEPTH

private KEY_BYTES

private CREATE_ATTEMPTS

private FILE_PREFIX

private FILE_SUFFIX

private LOCAL_KEY_FILE

Methods

__construct(string $directory, DirectoryManagerInterface $directoryManager, string|null $applicationSecret = null, string $namespace = 'lemonade', string|null $keyFile = null, string|null $storageRoot = null, string|null $publicRoot = null, int $maxFileBytes = self::DEFAULT_MAX_FILE_BYTES, int $maxSerializationDepth = self::DEFAULT_MAX_SERIALIZATION_DEPTH)

Binds cache persistence to a private directory and configures authenticated payload limits.

CacheItemInterface
getItem(string $key)

Loads one authenticated payload, returning a miss for absent, expired, corrupted, or modified state.

CacheItemInterface
iterable
getItems(array $keys = [])

Returns requested entries keyed by their original cache keys.

iterable
bool
hasItem(string $key)

Reports whether a live, authenticated payload exists for the validated key.

bool
bool
clear()

Removes only authenticated-format files whose names belong to this pool namespace.

bool
bool
deleteItem(string $key)

Removes one persisted or deferred entry without following a symbolic link at its managed path.

bool
bool
deleteItems(array $keys)

Removes each requested entry and reports whether every deletion succeeded.

bool
bool
save(CacheItemInterface $item)

Serializes and authenticates one framework cache item before atomically replacing its managed file.

bool
bool
saveDeferred(CacheItemInterface $item)

Queues a framework cache item for a later commit without writing its payload yet.

bool
bool
commit()

Writes every deferred payload and reports whether all saves succeeded.

bool

Details

__construct

__construct(string $directory, DirectoryManagerInterface $directoryManager, string|null $applicationSecret = null, string $namespace = 'lemonade', string|null $keyFile = null, string|null $storageRoot = null, string|null $publicRoot = null, int $maxFileBytes = self::DEFAULT_MAX_FILE_BYTES, int $maxSerializationDepth = self::DEFAULT_MAX_SERIALIZATION_DEPTH)

Binds cache persistence to a private directory and configures authenticated payload limits.

The first two arguments preserve the original construction API. Framework-managed instances additionally provide application boundaries so configured paths cannot leave storage or overlap the public web root.

Parameters

string $directory
DirectoryManagerInterface $directoryManager
string|null $applicationSecret
string $namespace
string|null $keyFile
string|null $storageRoot
string|null $publicRoot
int $maxFileBytes
int $maxSerializationDepth

Exceptions

CacheStorageException

getItem

CacheItemInterface getItem(string $key)

Loads one authenticated payload, returning a miss for absent, expired, corrupted, or modified state.

Parameters

string $key

Return Value

CacheItemInterface

Exceptions

InvalidCacheKeyException
CacheStorageException

getItems

iterable getItems(array $keys = [])

Returns requested entries keyed by their original cache keys.

Parameters

array $keys

Return Value

iterable

Exceptions

InvalidCacheKeyException
CacheStorageException

hasItem

bool hasItem(string $key)

Reports whether a live, authenticated payload exists for the validated key.

Parameters

string $key

Return Value

bool

Exceptions

InvalidCacheKeyException
CacheStorageException

clear

bool clear()

Removes only authenticated-format files whose names belong to this pool namespace.

Legacy PHP files, local integrity keys, other pools, and unrelated files are left untouched.

Return Value

bool

Exceptions

CacheStorageException

deleteItem

bool deleteItem(string $key)

Removes one persisted or deferred entry without following a symbolic link at its managed path.

Parameters

string $key

Return Value

bool

Exceptions

InvalidCacheKeyException
CacheStorageException

deleteItems

bool deleteItems(array $keys)

Removes each requested entry and reports whether every deletion succeeded.

Parameters

array $keys

Return Value

bool

Exceptions

InvalidCacheKeyException
CacheStorageException

save

bool save(CacheItemInterface $item)

Serializes and authenticates one framework cache item before atomically replacing its managed file.

Serialization failures or values exceeding the configured file limit return false without publication.

Parameters

CacheItemInterface $item

Return Value

bool

Exceptions

InvalidCacheKeyException
CacheStorageException

saveDeferred

bool saveDeferred(CacheItemInterface $item)

Queues a framework cache item for a later commit without writing its payload yet.

Parameters

CacheItemInterface $item

Return Value

bool

Exceptions

InvalidCacheKeyException

commit

bool commit()

Writes every deferred payload and reports whether all saves succeeded.

Return Value

bool

Exceptions

CacheStorageException