Elgg  Version 3.0
Public Member Functions | Protected Attributes | List of all members
Elgg\Cache\QueryCache Class Reference

Volatile cache for select queries. More...

Inheritance diagram for Elgg\Cache\QueryCache:
Elgg\Cache\LRUCache

Public Member Functions

 __construct (int $size=50, bool $config_disabled=false)
 
 enable ()
 Enable the query cache. More...
 
 disable ()
 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 ($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 ($key, $value)
 Assigns a value for the specified key. More...
 
 offsetGet ($key)
 Get the value for specified key. More...
 
 offsetUnset ($key)
 Unsets a key. More...
 
 offsetExists ($key)
 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

Elgg\Cache\QueryCache::__construct ( int  $size = 50,
bool  $config_disabled = false 
)

Parameters
int$sizemax items in LRU cache
bool$config_disabledis this cache allowed to be used

Definition at line 36 of file QueryCache.php.

Member Function Documentation

Elgg\Cache\QueryCache::clear ( )

Definition at line 84 of file QueryCache.php.

Elgg\Cache\QueryCache::disable ( )

Disable the query cache.

This is useful for special scripts that pull large amounts of data back in single queries.

Returns
void

Definition at line 62 of file QueryCache.php.

Elgg\Cache\QueryCache::enable ( )

Enable the query cache.

This does not take precedence over the setting.

Returns
void

Definition at line 50 of file QueryCache.php.

Elgg\Cache\QueryCache::get (   $key,
  $default = null 
)

Definition at line 95 of file QueryCache.php.

Elgg\Cache\QueryCache::getHash ( string  $sql,
array  $params = [],
string  $extras = '' 
)

Returns a hashed key for storage in the cache.

Parameters
string$sqlquery
array$paramsoptional params
string$extrasoptional extras
Returns
string

Definition at line 133 of file QueryCache.php.

Elgg\Cache\QueryCache::isEnabled ( )

Checks if this cache is enabled.

Returns
boolean

Definition at line 73 of file QueryCache.php.

Elgg\Cache\QueryCache::set (   $key,
  $value 
)

Definition at line 112 of file QueryCache.php.

Member Data Documentation

Elgg\Cache\QueryCache::$config_disabled = false
protected

Definition at line 23 of file QueryCache.php.

Elgg\Cache\QueryCache::$runtime_enabled = false
protected

Definition at line 28 of file QueryCache.php.


The documentation for this class was generated from the following file: