Least Recently Used Cache.
More...
Least Recently Used Cache.
A fixed sized cache that removes the element used last when it reaches its size limit.
Based on https://github.com/cash/LRUCache
Definition at line 17 of file LRUCache.php.
Elgg\Cache\LRUCache::__construct |
( |
int |
$size | ) |
|
Create a LRU Cache.
- Parameters
-
int | $size | The size of the cache |
- Exceptions
-
Definition at line 38 of file LRUCache.php.
Elgg\Cache\LRUCache::clear |
( |
| ) |
|
Elgg\Cache\LRUCache::containsKey |
( |
|
$key | ) |
|
Does the cache contain an element with this key.
- Parameters
-
- Returns
- boolean
Definition at line 102 of file LRUCache.php.
Elgg\Cache\LRUCache::get |
( |
|
$key, |
|
|
|
$default = null |
|
) |
| |
Get the value cached with this key.
- Parameters
-
int | string | $key | The key. Strings that are ints are cast to ints. |
mixed | $default | The value to be returned if key not found. (Optional) |
- Returns
- mixed
Definition at line 54 of file LRUCache.php.
Elgg\Cache\LRUCache::offsetExists |
( |
|
$offset | ) |
|
Does key exist?
- Parameters
-
int | string | $offset | A key to check for. |
- Returns
- boolean
- See also
- ::offsetExists()
Definition at line 194 of file LRUCache.php.
Elgg\Cache\LRUCache::offsetGet |
( |
|
$offset | ) |
|
Get the value for specified key.
- Parameters
-
int | string | $offset | The key to retrieve. |
- Returns
- mixed
- See also
- ::offsetGet()
Definition at line 168 of file LRUCache.php.
Elgg\Cache\LRUCache::offsetSet |
( |
|
$offset, |
|
|
|
$value |
|
) |
| |
Assigns a value for the specified key.
- Parameters
-
int | string | $offset | The key to assign the value to. |
mixed | $value | The value to set. |
- Returns
- void
- See also
- ::offsetSet()
Definition at line 155 of file LRUCache.php.
Elgg\Cache\LRUCache::offsetUnset |
( |
|
$offset | ) |
|
Unsets a key.
- Parameters
-
int | string | $offset | The key to unset. |
- Returns
- void
- See also
- ::offsetUnset()
Definition at line 181 of file LRUCache.php.
Elgg\Cache\LRUCache::recordAccess |
( |
|
$key | ) |
|
|
protected |
Moves the element from current position to end of array.
- Parameters
-
- Returns
- void
Definition at line 139 of file LRUCache.php.
Elgg\Cache\LRUCache::remove |
( |
|
$key | ) |
|
Remove the element with this key.
- Parameters
-
- Returns
- mixed Value or null if not set
Definition at line 113 of file LRUCache.php.
Elgg\Cache\LRUCache::set |
( |
|
$key, |
|
|
|
$value |
|
) |
| |
Add something to the cache.
- Parameters
-
int | string | $key | The key. Strings that are ints are cast to ints. |
mixed | $value | The value to cache |
- Returns
- void
Definition at line 72 of file LRUCache.php.
Elgg\Cache\LRUCache::size |
( |
| ) |
|
Get the number of elements in the cache.
- Returns
- int
Definition at line 91 of file LRUCache.php.
Elgg\Cache\LRUCache::$data = [] |
|
protected |
Elgg\Cache\LRUCache::$maximumSize |
|
protected |
The documentation for this class was generated from the following file: