MediaWiki REL1_40
Wikimedia\Stats\StatsCache Class Reference

Singleton cache for Metric instances. More...

Public Member Functions

 clear ()
 Clears the cache.
 
 get (string $component, string $name, string $expectedClass)
 Get a metric object from cache or null.
 
 getAllMetrics ()
 Get all metrics from cache.
 
 set (string $component, string $name, $metric)
 Add a metric object to the cache.
 

Detailed Description

Singleton cache for Metric instances.

For reuse and collision avoidance. Serves as the data source for Metric Renderers.

Author
Cole White
Since
1.41

Definition at line 37 of file StatsCache.php.

Member Function Documentation

◆ clear()

Wikimedia\Stats\StatsCache::clear ( )

Clears the cache.

Returns
void

Definition at line 88 of file StatsCache.php.

◆ get()

Wikimedia\Stats\StatsCache::get ( string $component,
string $name,
string $expectedClass )

Get a metric object from cache or null.

Parameters
string$component
string$name
string$expectedClass
Returns
MetricInterface|null
Exceptions
TypeErrorIf cached value is for a different metric type.

Definition at line 53 of file StatsCache.php.

◆ getAllMetrics()

Wikimedia\Stats\StatsCache::getAllMetrics ( )

Get all metrics from cache.

Returns
MetricInterface[]

Definition at line 79 of file StatsCache.php.

◆ set()

Wikimedia\Stats\StatsCache::set ( string $component,
string $name,
$metric )

Add a metric object to the cache.

Parameters
string$component
string$name
MetricInterface | NullMetric$metric

Definition at line 70 of file StatsCache.php.


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