ResourceCheckerConfigCache
in package
implements
ConfigCacheInterface
ResourceCheckerConfigCache uses instances of ResourceCheckerInterface to check whether cached data is still fresh.
Tags
Interfaces, Classes and Traits
- ConfigCacheInterface
- Interface for ConfigCache.
Table of Contents
- $file : string
- $resourceCheckers : iteratable<mixed, ResourceCheckerInterface>
- __construct() : mixed
- getPath() : string
- Gets the cache file path.
- isFresh() : bool
- Checks if the cache is still fresh.
- write() : mixed
- Writes cache.
- getMetaFile() : string
- Gets the meta file path.
- safelyUnserialize() : mixed
Properties
$file
private
string
$file
$resourceCheckers
private
iteratable<mixed, ResourceCheckerInterface>
$resourceCheckers
Methods
__construct()
public
__construct(string $file[, iteratable<mixed, ResourceCheckerInterface> $resourceCheckers = [] ]) : mixed
Parameters
- $file : string
-
The absolute cache path
- $resourceCheckers : iteratable<mixed, ResourceCheckerInterface> = []
-
The ResourceCheckers to use for the freshness check
Return values
mixed —getPath()
Gets the cache file path.
public
getPath() : string
Return values
string —isFresh()
Checks if the cache is still fresh.
public
isFresh() : bool
This implementation will make a decision solely based on the ResourceCheckers passed in the constructor.
The first ResourceChecker that supports a given resource is considered authoritative. Resources with no matching ResourceChecker will silently be ignored and considered fresh.
Return values
bool —write()
Writes cache.
public
write(string $content[, array<string|int, ResourceInterface> $metadata = null ]) : mixed
Parameters
- $content : string
-
The content to write in the cache
- $metadata : array<string|int, ResourceInterface> = null
-
An array of metadata
Tags
Return values
mixed —getMetaFile()
Gets the meta file path.
private
getMetaFile() : string
Return values
string —safelyUnserialize()
private
safelyUnserialize(string $file) : mixed
Parameters
- $file : string