- Symphony 2.4
-
› assets
13 -
› boot
11 -
› core
23 -
› cryptography
4 -
› email-gateways
3 -
› global
40 -
› interface
8 -
› toolkit
70 - Delegates89
- Deprecated11
Versions
- 2.7.9
- 2.7.8
- 2.7.7
- 2.7.6
- 2.7.5
- 2.7.3
- 2.7.2
- 2.7.10
- 2.7.1
- 2.7.0
- 2.6.9
- 2.6.8
- 2.6.7
- 2.6.6
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.11
- 2.6.10
- 2.6.1
- 2.6.0
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2
Options
public class Cacheable
class.cacheable.php #15The Cacheable class is used to store data in the dedicated Symphony
cache table. It is used by Symphony for Session management and by
the Dynamic XML datasource, but it can be used by extensions to store
anything. The cache table is tbl_cache
Methods
void __construct(iCache $cacheProvider)
The constructor for the Cacheable takes an instance of the
MySQL class and assigns it to $this->Database
Parameters
array|boolean check(
$hash)
Given the hash of a some data, check to see whether it exists in
tbl_cache
. If no cached object is found, this function will return
false, otherwise the cached object will be returned as an array.
Parameters
Returns
An associative array of the cached object including the creation time, expiry time, the hash and the data. If the object is not found, false will be returned.
Deprecated
This function will be removed in the next major version of Symphony. Use read()
instead.
void clean()
Removes all cache objects from tbl_cache
that have expired.
After removing, the function uses the optimise function
See Also
Deprecated
This function will be removed in the next major version of Symphony. Use delete()
instead.
static string|boolean compressData(
$data)
Given some data, this function will compress it using gzcompress
and then the result is run through base64_encode
If this fails,
false is returned otherwise the compressed data
Parameters
Returns
The compressed data, or false if an error occurred
static string|boolean decompressData(
$data)
Given compressed data, this function will decompress it and return the output.
Parameters
Returns
The decompressed data, or false if an error occurred
void delete(
$hash)
Given the hash of a cacheable object, remove it from tbl_cache
regardless of if it has expired or not. If no $hash is given,
this removes all cache objects from tbl_cache
that have expired.
After removing, the function uses the __optimise
function
Parameters
See Also
void forceExpiry(
$hash)
Given the hash of a cacheable object, remove it from tbl_cache
regardless of if it has expired or not.
Parameters
Deprecated
This function will be removed in the next major version of Symphony. Use delete()
instead.
string getType()
Returns the type of the internal caching provider
array|boolean read(
$hash)
Given the hash of a some data, check to see whether it exists in
tbl_cache
. If no cached object is found, this function will return
false, otherwise the cached object will be returned as an array.
Parameters
Returns
An associative array of the cached object including the creation time, expiry time, the hash and the data. If the object is not found, false will be returned.
boolean write(
$hash, $data, $ttl)
This function will compress data for storage in tbl_cache
.
It is left to the user to define a unique hash for this data so that it can be
retrieved in the future. Optionally, a $ttl
parameter can
be passed for this data. If this is omitted, it data is considered to be valid
forever. This function utilizes the Mutex class to act as a crude locking
mechanism.
Parameters
Returns
If an error occurs, this function will return false otherwise true