ChainCache
in package
implements
CacheInterface, RemovableCacheInterface
FinalYes
Chains several caches together.
Cached items are fetched from the first cache having them in its data store. They are saved and deleted in all adapters at once.
Tags
Table of Contents
Interfaces
- CacheInterface
- Interface implemented by cache classes.
- RemovableCacheInterface
Properties
- $caches : iterable<string|int, mixed>
Methods
- __construct() : mixed
- generateKey() : string
- Generates a cache key for the given template class name.
- getTimestamp() : int
- Returns the modification timestamp of a key.
- load() : void
- Loads a template from the cache.
- remove() : void
- write() : void
- Writes the compiled template to cache.
- splitKey() : array<string|int, string>
Properties
$caches
private
iterable<string|int, mixed>
$caches
Methods
__construct()
public
__construct(iterable<string|int, CacheInterface> $caches) : mixed
Parameters
- $caches : iterable<string|int, CacheInterface>
-
The ordered list of caches used to store and fetch cached items
generateKey()
Generates a cache key for the given template class name.
public
generateKey(string $name, string $className) : string
Parameters
- $name : string
- $className : string
Return values
stringgetTimestamp()
Returns the modification timestamp of a key.
public
getTimestamp(string $key) : int
Parameters
- $key : string
Return values
intload()
Loads a template from the cache.
public
load(string $key) : void
Parameters
- $key : string
remove()
public
remove(string $name, string $cls) : void
Parameters
- $name : string
- $cls : string
write()
Writes the compiled template to cache.
public
write(string $key, string $content) : void
Parameters
- $key : string
- $content : string
-
The template representation as a PHP class
splitKey()
private
splitKey(string $key) : array<string|int, string>
Parameters
- $key : string