|
| write (string $name, string $data, int $maxAge=-1) |
|
| exists (string $name) |
|
| get (string $name) |
|
| remove (string $name, bool $partial=false) |
|
SlaxWeb\Cache\AbstractHandler::checkData |
( |
string |
$serialized | ) |
|
|
protected |
Check data
Unserializes, checks the data and returns it. If the data is malformed or expired an exception is thrown.
- Parameters
-
string | $serialized | Serialized data |
- Returns
- array
- Exceptions
-
| SlaxWeb if cached data is malformed |
| SlaxWeb if cached data has expired |
SlaxWeb\Cache\AbstractHandler::exists |
( |
string |
$name | ) |
|
|
abstract |
Data exists
Checks if the data exists in the cache and retuns a bool value.
- Parameters
-
- Returns
- bool
SlaxWeb\Cache\AbstractHandler::get |
( |
string |
$name | ) |
|
|
abstract |
Get data
Gets the data from the cache based on the received name. If data is not found, an exception is thrown.
- Parameters
-
- Returns
- string
- Exceptions
-
SlaxWeb\Cache\AbstractHandler::prepData |
( |
string |
$data, |
|
|
int |
$maxAge = -1 |
|
) |
| |
|
protected |
Prepare data
Prepares the data for writting into cache. Adds the required timestamps, the actual data, and max age, and returns it all as a serialized array. If he method retrieves a maximum age value as second parameter it will use it instead of the default.
- Parameters
-
string | $data | User data for caching |
int | $maxAge | Maximum age in seconds, default -1 |
- Returns
- string
SlaxWeb\Cache\AbstractHandler::remove |
( |
string |
$name, |
|
|
bool |
$partial = false |
|
) |
| |
|
abstract |
Remove data
Removes the data from the cached based on the received name. If data is not found, an exception is thrown. If the second parameter is set to true, all cached data containing that name will be removed.
- Parameters
-
string | $name | Data name |
bool | $partial | Remove all data containing '$name', default false |
- Returns
- bool
- Exceptions
-
SlaxWeb\Cache\AbstractHandler::write |
( |
string |
$name, |
|
|
string |
$data, |
|
|
int |
$maxAge = -1 |
|
) |
| |
|
abstract |
Write
Write data to cache with the given name and data. The data must be in the string format.
- Parameters
-
string | $name | Data name |
string | $data | Data to cache |
int | $maxAge | Maximum age in seconds, default -1 |
- Returns
- self
- Exceptions
-
| SlaxWeb if an error occurs writting to cache |
The documentation for this class was generated from the following file:
- /opt/slax0rDev/slaxweb/cache/src/AbstractHandler.php