MediaWiki  master
MediaWiki\Settings\Cache\CachedSource Class Reference

Provides a caching layer for a CacheableSource. More...

Inheritance diagram for MediaWiki\Settings\Cache\CachedSource:
Collaboration diagram for MediaWiki\Settings\Cache\CachedSource:

Public Member Functions

 __construct (BagOStuff $cache, CacheableSource $source)
 Constructs a new CachedSource using an instantiated cache and CacheableSource. More...
 
 __toString ()
 Returns the string representation of the encapsulated source. More...
 
 load ()
 Queries cache for source contents and performs loading/caching of the source contents on miss. More...
 
 locateInclude (string $location)
 This method defines how a relative reference to the location of another settings source is interpreted. More...
 

Detailed Description

Provides a caching layer for a CacheableSource.

Stability: newable
Since
1.38

Definition at line 17 of file CachedSource.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Settings\Cache\CachedSource::__construct ( BagOStuff  $cache,
CacheableSource  $source 
)

Constructs a new CachedSource using an instantiated cache and CacheableSource.

Stability: stable
to call
Parameters
BagOStuff$cache
CacheableSource$source

Definition at line 38 of file CachedSource.php.

References $cache, and $source.

Member Function Documentation

◆ __toString()

MediaWiki\Settings\Cache\CachedSource::__toString ( )

Returns the string representation of the encapsulated source.

Returns
string

Definition at line 121 of file CachedSource.php.

◆ load()

MediaWiki\Settings\Cache\CachedSource::load ( )

Queries cache for source contents and performs loading/caching of the source contents on miss.

If the load fails but the source implements {} as true, stale results may be returned if still present in the cache store. array

Implements MediaWiki\Settings\Source\SettingsSource.

Definition at line 56 of file CachedSource.php.

◆ locateInclude()

MediaWiki\Settings\Cache\CachedSource::locateInclude ( string  $location)

This method defines how a relative reference to the location of another settings source is interpreted.

It tries to make $location absolute by interpreting it as relative to the location of the SettingsSource it originates from.

Implementation are "best effort". If a location cannot be made absolute, it may be returned as-is. Implementations are also free to throw a SettingsBuilderException to indicate that the given include location is not supported in this context.

Parameters
string$location
Returns
string
Exceptions
SettingsBuilderExceptionif the given location cannot be used as an include by the current source.

Implements MediaWiki\Settings\Source\SettingsIncludeLocator.

Definition at line 230 of file CachedSource.php.


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