Elgg
Version 2.3
|
Public Member Functions | |
get ($key, callable $callback=null, $default=null) | |
Fetches a value from the cache, with the option of calculating on miss. More... | |
invalidate ($key) | |
Forcefully invalidates the value associated with the given key. More... | |
put ($key, $value) | |
Prime the cache to a specific value. More... | |
Elgg\Cache\Pool::get | ( | $key, | |
callable | $callback = null , |
||
$default = null |
|||
) |
Fetches a value from the cache, with the option of calculating on miss.
string | int | $key | A plain string ID for the cache entry |
callable | null | $callback | Logic for calculating the cache entry on miss |
mixed | $default | Default value returned if the value is missing and no callback is provided |
Implemented in Elgg\Cache\Pool\StashWrapper, Elgg\Cache\Pool\InMemory, and Elgg\Cache\Pool\Noop.
Elgg\Cache\Pool::invalidate | ( | $key | ) |
Forcefully invalidates the value associated with the given key.
Implementations must:
string | int | $key | A plain string ID for the cache entry to invalidate. |
Implemented in Elgg\Cache\Pool\StashWrapper, Elgg\Cache\Pool\InMemory, and Elgg\Cache\Pool\Noop.
Elgg\Cache\Pool::put | ( | $key, | |
$value | |||
) |
Prime the cache to a specific value.
This is useful when the value was calculated by some out-of-band means. For example, when a list of rows is fetched from the database, you can prime the cache for each individual result.
string | int | $key | A plain string ID for the cache entry |
mixed | $value | The cache value |
Implemented in Elgg\Cache\Pool\StashWrapper, Elgg\Cache\Pool\InMemory, and Elgg\Cache\Pool\Noop.