The Elgg cache base class.
More...
|
| setVariable (string $variable, $value) |
| Set a cache variable. More...
|
|
| getVariable (string $variable) |
| Get variables for this cache. More...
|
|
| __get (string $key) |
| Class member get overloading, returning key using $this->load defaults. More...
|
|
| __set (string $key, $value) |
| Class member set overloading, setting a key using $this->save defaults. More...
|
|
| __isset (string $key) |
| Supporting isset, using $this->load() with default values. More...
|
|
| __unset (string $key) |
| Supporting unsetting of magic attributes. More...
|
|
| save ($key, $data, $expire_after=null) |
| Save data in a cache. More...
|
|
| load ($key) |
| Load data from the cache using a given key. More...
|
|
| delete ($key) |
| Invalidate a key. More...
|
|
| clear () |
| Clear out all the contents of the cache. More...
|
|
| invalidate () |
| Invalidate the contents of the cache. More...
|
|
| purge () |
| Purge old/stale contents of the cache. More...
|
|
| disable () |
| Disable cache Do not write or read from cache. More...
|
|
| enable () |
| Enable disabled cache. More...
|
|
| populate (array $values, int $expires_after=null) |
| Populate cache from an array of key => values. More...
|
|
| add (string $key, $data) |
| Add a key only if it doesn't already exist. More...
|
|
| offsetSet ($offset, $value) |
| Assigns a value for the specified key. More...
|
|
| offsetGet ($offset) |
| Get the value for specified key. More...
|
|
| offsetUnset ($offset) |
| Unsets a key. More...
|
|
| offsetExists ($offset) |
| Does key exist. More...
|
|
The Elgg cache base class.
This defines the interface for a cache (wherever that cache is stored).
Definition at line 9 of file BaseCache.php.
Elgg\Cache\BaseCache::__get |
( |
string |
$key | ) |
|
Class member get overloading, returning key using $this->load defaults.
- Parameters
-
- Returns
- mixed
Definition at line 50 of file BaseCache.php.
Elgg\Cache\BaseCache::__isset |
( |
string |
$key | ) |
|
Supporting isset, using $this->load() with default values.
- Parameters
-
string | $key | The name of the attribute or metadata. |
- Returns
- bool
Definition at line 73 of file BaseCache.php.
Elgg\Cache\BaseCache::__set |
( |
string |
$key, |
|
|
|
$value |
|
) |
| |
Class member set overloading, setting a key using $this->save defaults.
- Parameters
-
string | $key | Name |
mixed | $value | Value |
- Returns
- void
Definition at line 62 of file BaseCache.php.
Elgg\Cache\BaseCache::__unset |
( |
string |
$key | ) |
|
Supporting unsetting of magic attributes.
- Parameters
-
string | $key | The name of the attribute or metadata. |
- Returns
- void
Definition at line 84 of file BaseCache.php.
Elgg\Cache\BaseCache::add |
( |
string |
$key, |
|
|
|
$data |
|
) |
| |
Add a key only if it doesn't already exist.
Implemented simply here, if you extend this class and your caching engine provides a better way then override this accordingly.
- Parameters
-
string | $key | Name |
mixed | $data | Value |
- Returns
- bool
Definition at line 180 of file BaseCache.php.
Elgg\Cache\BaseCache::clear |
( |
| ) |
|
|
abstract |
Clear out all the contents of the cache.
- Returns
- bool
Elgg\Cache\BaseCache::delete |
( |
|
$key | ) |
|
|
abstract |
Invalidate a key.
- Parameters
-
- Returns
- bool
Elgg\Cache\BaseCache::disable |
( |
| ) |
|
Disable cache Do not write or read from cache.
- Returns
- void
Definition at line 143 of file BaseCache.php.
Elgg\Cache\BaseCache::enable |
( |
| ) |
|
Enable disabled cache.
- Returns
- void
Definition at line 151 of file BaseCache.php.
Elgg\Cache\BaseCache::getVariable |
( |
string |
$variable | ) |
|
Get variables for this cache.
- Parameters
-
- Returns
- mixed The variable or null;
Definition at line 39 of file BaseCache.php.
Elgg\Cache\BaseCache::invalidate |
( |
| ) |
|
|
abstract |
Invalidate the contents of the cache.
- Returns
- bool
Elgg\Cache\BaseCache::load |
( |
|
$key | ) |
|
|
abstract |
Load data from the cache using a given key.
- Parameters
-
- Returns
- mixed|null The stored data or null if it's a miss
Elgg\Cache\BaseCache::offsetExists |
( |
|
$offset | ) |
|
Does key exist.
- See also
- ::offsetExists()
- Parameters
-
mixed | $offset | A key (offset) to check for. |
- Returns
- bool
Definition at line 245 of file BaseCache.php.
Elgg\Cache\BaseCache::offsetGet |
( |
|
$offset | ) |
|
Get the value for specified key.
- See also
- ::offsetGet()
- Parameters
-
mixed | $offset | The key (offset) to retrieve. |
- Returns
- mixed
Definition at line 215 of file BaseCache.php.
Elgg\Cache\BaseCache::offsetSet |
( |
|
$offset, |
|
|
|
$value |
|
) |
| |
Assigns a value for the specified key.
- Parameters
-
mixed | $offset | The key (offset) to assign the value to. |
mixed | $value | The value to set. |
- Returns
- void
- See also
- ::offsetSet()
Definition at line 201 of file BaseCache.php.
Elgg\Cache\BaseCache::offsetUnset |
( |
|
$offset | ) |
|
Unsets a key.
- See also
- ::offsetUnset()
- Parameters
-
mixed | $offset | The key (offset) to unset. |
- Returns
- void
Definition at line 229 of file BaseCache.php.
Elgg\Cache\BaseCache::populate |
( |
array |
$values, |
|
|
int |
$expires_after = null |
|
) |
| |
Populate cache from an array of key => values.
- Parameters
-
array | $values | Values |
int | $expires_after | Expiration duration |
- Returns
- void
Definition at line 163 of file BaseCache.php.
Elgg\Cache\BaseCache::purge |
( |
| ) |
|
|
abstract |
Purge old/stale contents of the cache.
- Returns
- bool
Elgg\Cache\BaseCache::save |
( |
|
$key, |
|
|
|
$data, |
|
|
|
$expire_after = null |
|
) |
| |
|
abstract |
Save data in a cache.
- Parameters
-
string | $key | Name |
mixed | $data | Value |
int | $expire_after | Number of seconds to expire the cache after |
- Returns
- bool
Elgg\Cache\BaseCache::setVariable |
( |
string |
$variable, |
|
|
|
$value |
|
) |
| |
Set a cache variable.
- Parameters
-
string | $variable | Name |
mixed | $value | Value |
- Returns
- void
Definition at line 28 of file BaseCache.php.
bool Elgg\Cache\BaseCache::$disabled = false |
|
protected |
The documentation for this class was generated from the following file: