Constructor
Class constructor copies the dependencies to the class properties. The Cache Manager depends on the cache handler object, and uses it throughout its execution to write and read from the cache.
- Parameters
-
\SlaxWeb\Cache\AbstractHandler | $handler | Cache handler object |
SlaxWeb\Cache\Manager::read |
( |
string |
$name | ) |
|
Read
Reads the data from the cache and returns. If the data has expired, it will automatically remove the expired data from the cache. It does not handle any handler thrown exceptions, and simply returns that what it receives.
- Parameters
-
string | $name | Name of the data stored in cache |
- Returns
- mixed
SlaxWeb\Cache\Manager::remove |
( |
string |
$name, |
|
|
bool |
$partial = false |
|
) |
| |
Remove
Removes the data from the cache. No exceptions are handled that are thrown in the handler. It accepts the name of the cached data. If the second parameter is set to true, all cached data containing that name will be removed.
- Parameters
-
string | $name | Name of the data stored in cache |
bool | $partial | Remove all data containing '$name', default false |
- Returns
- bool
SlaxWeb\Cache\Manager::write |
( |
string |
$name, |
|
|
|
$data, |
|
|
int |
$maxAge = -1 |
|
) |
| |
Write
Serializes the data and writes it to cache using the handler. It accepts the name for the cached data as the first parameter, the data as the second parameter, and a maximum age value as the third parameter. If the maximum age is not supplied or is of a negative value, the configured default is used. If an error occurs when trying to write to cahce, bool(false) is returned, bool(true) otherwise.
- Parameters
-
string | $name | Name of the data to be written to cache |
mixed | $data | Data to be stored into the cache |
int | $maxAge | Maximum age for this specific data, default -1 |
- Returns
- bool
The documentation for this class was generated from the following file:
- /opt/slax0rDev/slaxweb/cache/src/Manager.php