MediaWiki master
MediaWiki\Settings\Cache\CachedSource Class Reference

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

Inherits Stringable, MediaWiki\Settings\Source\SettingsSource, and MediaWiki\Settings\Source\SettingsIncludeLocator.

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.
 
 __toString ()
 Returns the string representation of the encapsulated source.
 
 load ()
 Queries cache for source contents and performs loading/caching of the source contents on miss.
 
 locateInclude (string $location)
 This method defines how a relative reference to the location of another settings source is interpreted.
 

Detailed Description

Provides a caching layer for a CacheableSource.

Stability: newable
Since
1.38

Definition at line 18 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 39 of file CachedSource.php.

References $source.

Member Function Documentation

◆ __toString()

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

Returns the string representation of the encapsulated source.

Returns
string

Definition at line 122 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 CacheableSource::allowsStaleLoad() as true, stale results may be returned if still present in the cache store.

Returns
array

Implements MediaWiki\Settings\Source\SettingsSource.

Definition at line 57 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 231 of file CachedSource.php.


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