Cache frontends
Frontend API
All frontends must implement the API defined in interface TYPO3\.
All operations on a specific cache must be done with these methods. The frontend object of a cache is the main object
any cache manipulation is done with, usually the assigned backend object should not be used directly.
|
Method |
Description |
|---|---|
|
getIdentifier |
Returns the cache identifier. |
|
getBackend |
Returns the backend instance of this cache. It is seldom needed in usual code. |
|
set |
Sets/overwrites an entry in the cache. |
|
get |
Returns the cache entry for the given identifier. |
|
has |
Checks for existence of a cache entry.
Do no use this prior to |
|
remove |
Removes the entry for the given identifier from the cache. |
|
flushByTag |
Flushes all cache entries which are tagged with the given tag. |
|
collectGarbage |
Calls the garbage collection method of the backend. This is important for backends which are unable to do this internally (like the DB backend). |
|
isValidEntryIdentifier |
Checks if a given identifier is valid. |
|
isValidTag |
Checks if a given tag is valid. |
|
requireOnce |
PhpFrontend only Requires a cached PHP file directly. |
Available Frontends
Currently two different frontends are implemented. The main difference are the data types which can be stored using a specific frontend.
Variable Frontend
Strings, arrays and objects are accepted by this frontend. Data is serialized before it is passed to the backend.
Tip
The variable frontend is the most frequently used frontend and handles the widest range of data types.
PHP Frontend
This is a special frontend to cache PHP files. It extends the string frontend
with the method require which allows PHP files to be require'd
if a cache entry exists. This can be used by extensions to cache and speed up loading
of calculated PHP code and becomes handy if a lot of reflection and
dynamic PHP class construction is done.
A backend to be used in combination with the PHP frontend must implement the interface
TYPO3\. Currently the file backend and
the simple file backend fulfill this requirement.
Note
The PHP frontend can only be used to cache PHP files. It does not work with strings, arrays or objects. It is not intended as a page content cache.