Inherits Doctrine_Cache_Driver.
Definition at line 35 of file Xcache.php.
| Doctrine_Cache_Xcache::__construct |
( |
|
$options = array() | ) |
|
constructor
- Parameters
-
| array | $options | associative array of cache driver options |
Definition at line 42 of file Xcache.php.
{
if ( ! extension_loaded('xcache') ) {
}
parent::__construct($options);
}
| Doctrine_Cache_Xcache::_doContains |
( |
|
$id | ) |
|
|
protected |
Test if a cache is available or not (for the given id)
- Parameters
-
- Returns
- mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
Definition at line 68 of file Xcache.php.
{
return xcache_isset($id);
}
| Doctrine_Cache_Xcache::_doDelete |
( |
|
$id | ) |
|
|
protected |
Remove a cache record directly. This method is implemented by the cache drivers and used in Doctrine_Cache_Driver::delete()
- Parameters
-
- Returns
- boolean true if no problem
Definition at line 94 of file Xcache.php.
{
return xcache_unset($id);
}
| Doctrine_Cache_Xcache::_doFetch |
( |
|
$id, |
|
|
|
$testCacheValidity = true |
|
) |
| |
|
protected |
Test if a cache record exists for the passed id
- Parameters
-
- Returns
- mixed Returns either the cached data or false
Definition at line 57 of file Xcache.php.
{
return $this->
_doContains($id) ? xcache_get($id) : false;
}
| Doctrine_Cache_Xcache::_doSave |
( |
|
$id, |
|
|
|
$data, |
|
|
|
$lifeTime = false |
|
) |
| |
|
protected |
Save a cache record directly. This method is implemented by the cache drivers and used in Doctrine_Cache_Driver::save()
- Parameters
-
| string | $id | cache id |
| string | $data | data to cache |
| int | $lifeTime | if != false, set a specific lifetime for this cache record (null => infinite lifeTime) |
- Returns
- boolean true if no problem
Definition at line 82 of file Xcache.php.
{
return xcache_set($id, $data, $lifeTime);
}
| Doctrine_Cache_Xcache::_getCacheKeys |
( |
| ) |
|
|
protected |
Fetch an array of all keys stored in cache
- Returns
- array Returns the array of cache keys
Definition at line 104 of file Xcache.php.
{
$keys = array();
for ($i = 0, $count = xcache_count(XC_TYPE_VAR); $i < $count; $i++) {
$entries = xcache_list(XC_TYPE_VAR, $i);
if (is_array($entries['cache_list'])) {
foreach ($entries['cache_list'] as $entry) {
$keys[] = $entry['name'];
}
}
}
return $keys;
}
| Doctrine_Cache_Driver::_getKey |
( |
|
$id | ) |
|
|
protectedinherited |
Get the hash key passing its suffix
- Parameters
-
| string | $id | The hash key suffix |
- Returns
- string Hash key to be used by drivers
Definition at line 226 of file Driver.php.
{
$prefix = isset($this->_options['prefix']) ? $this->_options['prefix'] : '';
if ( ! $prefix || strpos($id, $prefix) === 0) {
return $id;
} else {
return $prefix . $id;
}
}
| Doctrine_Cache_Xcache::checkAuth |
( |
| ) |
|
|
protected |
Checks that xcache.admin.enable_auth is Off
- Exceptions
-
- Returns
- void
Definition at line 125 of file Xcache.php.
{
if (ini_get('xcache.admin.enable_auth')) {
throw new Doctrine_Cache_Exception(
'To use all features of Doctrine_Cache_Xcache, you must set "xcache.admin.enable_auth" to "Off" in your php.ini.');
}
}
| Doctrine_Cache_Driver::contains |
( |
|
$id | ) |
|
|
inherited |
Test if a cache record exists for the passed id
- Parameters
-
- Returns
- mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
Definition at line 101 of file Driver.php.
| Doctrine_Cache_Driver::delete |
( |
|
$id | ) |
|
|
inherited |
Remove a cache record
Note: This method accepts wildcards with the * character
- Parameters
-
- Returns
- boolean true if no problem
Definition at line 129 of file Driver.php.
{
if (strpos($key, '*') !== false) {
return $this->
deleteByRegex(
'/' . str_replace(
'*',
'.*', $key) .
'/');
}
}
| Doctrine_Cache_Driver::deleteAll |
( |
| ) |
|
|
inherited |
Delete all cache entries from the cache driver
- Returns
- integer $count The number of deleted cache entries
Definition at line 208 of file Driver.php.
{
$count = 0;
foreach ($keys as $key) {
$count++;
$this->delete($key);
}
}
return $count;
}
| Doctrine_Cache_Driver::deleteByPrefix |
( |
|
$prefix | ) |
|
|
inherited |
Delete cache entries where the key has the passed prefix
- Parameters
-
- Returns
- integer $count The number of deleted cache entries
Definition at line 167 of file Driver.php.
{
$count = 0;
if (is_array($keys)) {
foreach ($keys as $key) {
if (strpos($key, $prefix) === 0) {
$count++;
$this->delete($key);
}
}
}
return $count;
}
| Doctrine_Cache_Driver::deleteByRegex |
( |
|
$regex | ) |
|
|
inherited |
Delete cache entries where the key matches a PHP regular expressions
- Parameters
-
- Returns
- integer $count The number of deleted cache entries
Definition at line 146 of file Driver.php.
{
$count = 0;
if (is_array($keys)) {
foreach ($keys as $key) {
if (preg_match($regex, $key)) {
$count++;
$this->delete($key);
}
}
}
return $count;
}
| Doctrine_Cache_Driver::deleteBySuffix |
( |
|
$suffix | ) |
|
|
inherited |
Delete cache entries where the key has the passed suffix
- Parameters
-
- Returns
- integer $count The number of deleted cache entries
Definition at line 188 of file Driver.php.
{
$count = 0;
if (is_array($keys)) {
foreach ($keys as $key) {
if (substr($key, -1 * strlen($suffix)) == $suffix) {
$count++;
$this->delete($key);
}
}
}
return $count;
}
| Doctrine_Cache_Driver::fetch |
( |
|
$id, |
|
|
|
$testCacheValidity = true |
|
) |
| |
|
inherited |
Fetch a cache record from this cache driver instance
- Parameters
-
| string | $id | cache id |
| boolean | $testCacheValidity | if set to false, the cache validity won't be tested |
- Returns
- mixed Returns either the cached data or false
Definition at line 89 of file Driver.php.
{
return $this->
_doFetch($key, $testCacheValidity);
}
| Doctrine_Cache_Driver::getOption |
( |
|
$option | ) |
|
|
inherited |
Get value of option
- Parameters
-
| mixed | $option | the option name |
- Returns
- mixed option value
Definition at line 73 of file Driver.php.
{
if ( ! isset($this->_options[$option])) {
return null;
}
return $this->_options[$option];
}
| Doctrine_Cache_Driver::save |
( |
|
$id, |
|
|
|
$data, |
|
|
|
$lifeTime = false |
|
) |
| |
|
inherited |
Save some string datas into a cache record
- Parameters
-
| string | $id | cache id |
| string | $data | data to cache |
| int | $lifeTime | if != false, set a specific lifetime for this cache record (null => infinite lifeTime) |
- Returns
- boolean true if no problem
Definition at line 115 of file Driver.php.
{
return $this->
_doSave($key, $data, $lifeTime);
}
| Doctrine_Cache_Driver::setOption |
( |
|
$option, |
|
|
|
$value |
|
) |
| |
|
inherited |
Set option name and value
- Parameters
-
| mixed | $option | the option name |
| mixed | $value | option value |
- Returns
- boolean TRUE on success, FALSE on failure
Definition at line 58 of file Driver.php.
{
if (isset($this->_options[$option])) {
$this->_options[$option] = $value;
return true;
}
return false;
}
The documentation for this class was generated from the following file: