Elgg  Version 1.11
Public Member Functions | List of all members
Elgg\Cache\Pool Interface Reference
Inheritance diagram for Elgg\Cache\Pool:
Elgg\Cache\MemoryPool Elgg\Cache\NullPool Elgg\Cache\StashPool

Public Member Functions

 get ($key, callable $callback)
 Fetches a value from the cache, calculating on miss via $callback. More...
 
 invalidate ($key)
 Forcefully invalidates the value associated with the given key. More...
 
 put ($key, $value)
 Prime the cache to a specific value. More...
 

Detailed Description

Definition at line 19 of file Pool.php.

Member Function Documentation

Elgg\Cache\Pool::get (   $key,
callable  $callback 
)

Fetches a value from the cache, calculating on miss via $callback.

Parameters
string | int$keyA plain string ID for the cache entry
callable$callbackLogic for calculating the cache entry on miss
Returns
mixed The cache value

Implemented in Elgg\Cache\StashPool, Elgg\Cache\MemoryPool, and Elgg\Cache\NullPool.

Elgg\Cache\Pool::invalidate (   $key)

Forcefully invalidates the value associated with the given key.

Implementations must:

  • Immediately consider the value stale
  • Recalculate the value at the next opportunity
Parameters
string | int$keyA plain string ID for the cache entry to invalidate.
Returns
void

Implemented in Elgg\Cache\StashPool, Elgg\Cache\MemoryPool, and Elgg\Cache\NullPool.

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.

Parameters
string | int$keyA plain string ID for the cache entry
mixed$valueThe cache value
Returns
void

Implemented in Elgg\Cache\StashPool, Elgg\Cache\MemoryPool, and Elgg\Cache\NullPool.


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