Handles a simple LRU key/value map with a maximum number of entries.
More...
Handles a simple LRU key/value map with a maximum number of entries.
Use ProcessCacheLRU if hierarchical purging is needed or objects can become stale
- See also
- ProcessCacheLRU
- Since
- 1.23
Definition at line 33 of file MapCacheLRU.php.
◆ __construct()
MapCacheLRU::__construct |
( |
|
$maxKeys | ) |
|
- Parameters
-
$maxKeys | integer Maximum number of entries allowed (min 1). |
- Exceptions
-
Definition at line 42 of file MapCacheLRU.php.
◆ clear()
MapCacheLRU::clear |
( |
|
$keys = null | ) |
|
◆ get()
Get the value for a key.
This returns null if the key is not set. If the item is already set, it will be pushed to the top of the cache.
- Parameters
-
- Returns
- mixed
Definition at line 87 of file MapCacheLRU.php.
References cache, and ping().
◆ has()
Check if a key exists.
- Parameters
-
- Returns
- bool
Definition at line 75 of file MapCacheLRU.php.
References cache.
◆ ping()
MapCacheLRU::ping |
( |
|
$key | ) |
|
|
protected |
◆ set()
MapCacheLRU::set |
( |
|
$key, |
|
|
|
$value |
|
) |
| |
Set a key/value pair.
This will prune the cache if it gets too large based on LRU. If the item is already set, it will be pushed to the top of the cache.
- Parameters
-
- Returns
- void
Definition at line 58 of file MapCacheLRU.php.
References $value, cache, key, and ping().
◆ $cache
Array MapCacheLRU::$cache = array() |
|
protected |
◆ $maxCacheKeys
MapCacheLRU::$maxCacheKeys |
|
protected |
The documentation for this class was generated from the following file: