Inherits Doctrine_Cache_Driver.
Definition at line 34 of file Array.php.
| Doctrine_Cache_Array::_doContains |
( |
|
$id | ) |
|
|
protected |
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 62 of file Array.php.
{
return isset($this->data[$id]);
}
| Doctrine_Cache_Array::_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 90 of file Array.php.
{
$exists = isset($this->data[$id]);
unset($this->data[$id]);
return $exists;
}
| Doctrine_Cache_Array::_doFetch |
( |
|
$id, |
|
|
|
$testCacheValidity = true |
|
) |
| |
|
protected |
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 48 of file Array.php.
{
if (isset($this->data[$id])) {
return $this->data[$id];
}
return false;
}
| Doctrine_Cache_Array::_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 76 of file Array.php.
{
$this->data[$id] = $data;
return true;
}
| Doctrine_Cache_Array::_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 Array.php.
{
return array_keys($this->data);
}
| 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_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: