Handles per process caching of items.
More...
|
| __construct ($maxKeys) |
|
| clear ($keys=null) |
| Clear one or several cache entries, or all cache entries. More...
|
|
| get ($key, $prop) |
| Get a property field for a cache entry. More...
|
|
| has ($key, $prop, $maxAge=0.0) |
| Check if a property field exists for a cache entry. More...
|
|
| resize ($maxKeys) |
| Resize the maximum number of cache entries, removing older entries as needed. More...
|
|
| set ($key, $prop, $value) |
| Set a property field for a cache entry. More...
|
|
Handles per process caching of items.
Definition at line 29 of file ProcessCacheLRU.php.
ProcessCacheLRU::__construct |
( |
|
$maxKeys | ) |
|
- Parameters
-
int | $maxKeys | Maximum number of entries allowed (min 1). |
- Exceptions
-
UnexpectedValueException | When $maxCacheKeys is not an int or =< 0. |
Definition at line 42 of file ProcessCacheLRU.php.
References resize().
ProcessCacheLRU::clear |
( |
|
$keys = null | ) |
|
ProcessCacheLRU::get |
( |
|
$key, |
|
|
|
$prop |
|
) |
| |
ProcessCacheLRU::has |
( |
|
$key, |
|
|
|
$prop, |
|
|
|
$maxAge = 0.0 |
|
) |
| |
Check if a property field exists for a cache entry.
- Parameters
-
string | $key | |
string | $prop | |
float | $maxAge | Ignore items older than this many seconds (since 1.21) |
- Returns
- bool
Definition at line 77 of file ProcessCacheLRU.php.
References cache.
ProcessCacheLRU::ping |
( |
|
$key | ) |
|
|
protected |
ProcessCacheLRU::resize |
( |
|
$maxKeys | ) |
|
Resize the maximum number of cache entries, removing older entries as needed.
- Parameters
-
- Returns
- void
- Exceptions
-
Definition at line 129 of file ProcessCacheLRU.php.
References cache, and key.
Referenced by __construct().
ProcessCacheLRU::set |
( |
|
$key, |
|
|
|
$prop, |
|
|
|
$value |
|
) |
| |
Set a property field for a cache entry.
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
-
string | $key | |
string | $prop | |
mixed | $value | |
- Returns
- void
Definition at line 56 of file ProcessCacheLRU.php.
References $value, cache, key, and ping().
Array ProcessCacheLRU::$cache = [] |
|
protected |
Array ProcessCacheLRU::$cacheTimes = [] |
|
protected |
ProcessCacheLRU::$maxCacheKeys |
|
protected |
The documentation for this class was generated from the following file: