Elgg
Version 6.0
|
Volatile cache for select queries. More...
Public Member Functions | |
__construct (int $size=50, bool $config_disabled=false) | |
enable () | |
Enable the query cache. More... | |
disable (bool $clear=true) | |
Disable the query cache. More... | |
isEnabled () | |
Checks if this cache is enabled. More... | |
clear () | |
get ($key, $default=null) | |
set ($key, $value) | |
getHash (string $sql, array $params=[], string $extras= '') | |
Returns a hashed key for storage in the cache. More... | |
Public Member Functions inherited from Elgg\Cache\LRUCache | |
__construct (int $size) | |
Create a LRU Cache. More... | |
get ($key, $default=null) | |
Get the value cached with this key. More... | |
set ($key, $value) | |
Add something to the cache. More... | |
size () | |
Get the number of elements in the cache. More... | |
containsKey ($key) | |
Does the cache contain an element with this key. More... | |
remove ($key) | |
Remove the element with this key. More... | |
clear () | |
Clear the cache. 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... | |
Protected Attributes | |
$config_disabled = false | |
$runtime_enabled = false | |
Protected Attributes inherited from Elgg\Cache\LRUCache | |
$maximumSize | |
$data = [] | |
Additional Inherited Members | |
Protected Member Functions inherited from Elgg\Cache\LRUCache | |
recordAccess ($key) | |
Moves the element from current position to end of array. More... | |
Volatile cache for select queries.
Queries and their results are stored in this cache as: $DB_QUERY_CACHE[query hash] => array(result1, result2, ... resultN)
Definition at line 17 of file QueryCache.php.
Elgg\Cache\QueryCache::__construct | ( | int | $size = 50 , |
bool | $config_disabled = false |
||
) |
int | $size | max items in LRU cache |
bool | $config_disabled | is this cache allowed to be used |
Definition at line 37 of file QueryCache.php.
Elgg\Cache\QueryCache::clear | ( | ) |
Definition at line 89 of file QueryCache.php.
Elgg\Cache\QueryCache::disable | ( | bool | $clear = true | ) |
Disable the query cache.
This is useful for special scripts that pull large amounts of data back in single queries.
bool | $clear | also clear the cache (default: true) |
Definition at line 65 of file QueryCache.php.
Elgg\Cache\QueryCache::enable | ( | ) |
Enable the query cache.
This does not take precedence over the setting.
Definition at line 51 of file QueryCache.php.
Elgg\Cache\QueryCache::get | ( | $key, | |
$default = null |
|||
) |
Definition at line 98 of file QueryCache.php.
Elgg\Cache\QueryCache::getHash | ( | string | $sql, |
array | $params = [] , |
||
string | $extras = '' |
||
) |
Returns a hashed key for storage in the cache.
string | $sql | query |
array | $params | optional params |
string | $extras | optional extras |
Definition at line 132 of file QueryCache.php.
Elgg\Cache\QueryCache::isEnabled | ( | ) |
Elgg\Cache\QueryCache::set | ( | $key, | |
$value | |||
) |
Definition at line 113 of file QueryCache.php.
|
protected |
Definition at line 24 of file QueryCache.php.
|
protected |
Definition at line 29 of file QueryCache.php.