MediaWiki master
Wikimedia\ObjectCache\IWANCacheBuilder Interface Reference

Source of fluent builders for WANObjectCache::getWithSetCallback() calls. More...

Inherited by Wikimedia\ObjectCache\WANObjectCache.

Public Member Functions

 buildGetWithSetCallback ()
 Create a builder for a getWithSetCallback() call.
 

Detailed Description

Source of fluent builders for WANObjectCache::getWithSetCallback() calls.

Since
1.47

Definition at line 15 of file IWANCacheBuilder.php.

Member Function Documentation

◆ buildGetWithSetCallback()

Wikimedia\ObjectCache\IWANCacheBuilder::buildGetWithSetCallback ( )

Create a builder for a getWithSetCallback() call.

This is the preferred way to call getWithSetCallback(): the builder makes the cache key and names each of the options, so that a call reads as prose rather than as an options map that has to be looked up.

$stats = $cache->buildGetWithSetCallback()
->key( 'language-stats' )
->keepIndefinitely()
->invalidatedByKey( 'language-stats' )
->shortProcessCache()
->getWithSetCallback( static function () {
return self::getAllLanguageStats();
} );
See also
WANGetWithSetCallbackBuilder
Since
1.47
Returns
WANGetWithSetCallbackBuilder

Implemented in Wikimedia\ObjectCache\WANObjectCache.


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