Elgg
Version 6.0
|
Composite cache pool. More...
Public Member Functions | |
__construct ($namespace, Config $config, $flags, bool $validate_lastcache=true) | |
Constructor. 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) | |
clear () | |
invalidate () | |
purge () | |
setNamespace ($namespace= 'default') | |
Set the namespace of this cache. More... | |
getNamespace () | |
Get the namespace currently defined. More... | |
Public Member Functions inherited from Elgg\Cache\BaseCache | |
__construct () | |
Set the constructor. 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... | |
Static Public Member Functions | |
static | isMemcacheAvailable () |
Helper function to check if memcache is available. More... | |
static | isRedisAvailable () |
Helper function to check if Redis is available. More... | |
Protected Member Functions | |
prefixInstanceId (string $id) | |
Prefixes instance ids with namespace. More... | |
sanitizeItemKey ($key) | |
Sanitizes item key for cache. More... | |
createPool () | |
Create a new cluster/pool of drivers. More... | |
buildRedisDriver () | |
Builds Redis driver. More... | |
buildMemcachedDriver () | |
Builds Memcached driver. More... | |
buildFileSystemDriver () | |
Builds file system driver. More... | |
buildLocalFileSystemDriver () | |
Builds local file system driver. More... | |
buildEphemeralDriver () | |
Builds in-memory driver. More... | |
buildBlackHoleDriver () | |
Builds null cache driver. More... | |
Protected Attributes | |
$ttl = 86400 | |
TTL of saved items (default timeout after a day to prevent anything getting too stale) More... | |
$config | |
$flags | |
$pool | |
$namespace | |
$validate_lastcache | |
Protected Attributes inherited from Elgg\Cache\BaseCache | |
$disabled = false | |
Composite cache pool.
Definition at line 20 of file CompositeCache.php.
Elgg\Cache\CompositeCache::__construct | ( | $namespace, | |
Config | $config, | ||
$flags, | |||
bool | $validate_lastcache = true |
||
) |
Constructor.
string | $namespace | Cache namespace |
Config | $config | Elgg config |
int | $flags | Start flags |
bool | $validate_lastcache | During load validate ElggConfig::lastcache |
Definition at line 60 of file CompositeCache.php.
|
protected |
Builds null cache driver.
Definition at line 382 of file CompositeCache.php.
|
protected |
Builds in-memory driver.
Definition at line 365 of file CompositeCache.php.
|
protected |
Builds file system driver.
Definition at line 315 of file CompositeCache.php.
|
protected |
Builds local file system driver.
Definition at line 340 of file CompositeCache.php.
|
protected |
Builds Memcached driver.
Definition at line 294 of file CompositeCache.php.
|
protected |
Builds Redis driver.
Definition at line 273 of file CompositeCache.php.
Elgg\Cache\CompositeCache::clear | ( | ) |
Definition at line 147 of file CompositeCache.php.
|
protected |
Create a new cluster/pool of drivers.
ConfigurationException |
Definition at line 228 of file CompositeCache.php.
Elgg\Cache\CompositeCache::delete | ( | $key | ) |
Definition at line 136 of file CompositeCache.php.
Elgg\Cache\CompositeCache::getNamespace | ( | ) |
Get the namespace currently defined.
Definition at line 186 of file CompositeCache.php.
Elgg\Cache\CompositeCache::invalidate | ( | ) |
Definition at line 154 of file CompositeCache.php.
|
static |
Helper function to check if memcache is available.
Definition at line 399 of file CompositeCache.php.
|
static |
Helper function to check if Redis is available.
Definition at line 410 of file CompositeCache.php.
Elgg\Cache\CompositeCache::load | ( | $key | ) |
Load data from the cache using a given key.
string | $key | Name |
Definition at line 105 of file CompositeCache.php.
|
protected |
Prefixes instance ids with namespace.
string | $id | instance id |
Definition at line 199 of file CompositeCache.php.
Elgg\Cache\CompositeCache::purge | ( | ) |
Definition at line 163 of file CompositeCache.php.
|
protected |
Sanitizes item key for cache.
mixed | $key | input key |
InvalidArgumentException |
Definition at line 214 of file CompositeCache.php.
Elgg\Cache\CompositeCache::save | ( | $key, | |
$data, | |||
$expire_after = null |
|||
) |
Save data in a cache.
string | $key | Name |
mixed | $data | Value |
int | \DateTime | $expire_after | Expire value after |
Definition at line 79 of file CompositeCache.php.
Elgg\Cache\CompositeCache::setNamespace | ( | $namespace = 'default' | ) |
Set the namespace of this cache.
This is useful for cache types (like memcache or static variables) where there is one large flat area of memory shared across all instances of the cache.
string | $namespace | Namespace for cache |
Definition at line 177 of file CompositeCache.php.
|
protected |
Definition at line 30 of file CompositeCache.php.
|
protected |
Definition at line 35 of file CompositeCache.php.
|
protected |
Definition at line 45 of file CompositeCache.php.
|
protected |
Definition at line 40 of file CompositeCache.php.
|
protected |
TTL of saved items (default timeout after a day to prevent anything getting too stale)
Definition at line 25 of file CompositeCache.php.
|
protected |
Definition at line 50 of file CompositeCache.php.