MediaWiki REL1_40
Wikimedia\WRStats\WRStatsWriter Class Reference

Writers gather a batch of increment operations and then commit them when flush() is called, or when the writer is destroyed. More...

Public Member Functions

 __construct (StatsStore $store, $specs, $prefix)
 
 __destruct ()
 Commit the batch of increment operations.
 
 flush ()
 Commit the batch of increment operations.
 
 incr ( $name, ?EntityKey $entity=null, $value=1)
 Queue an increment operation.
 
 resetAll (?array $entities=null)
 Delete all stored metrics corresponding to the specs supplied to the constructor, resetting the counters to zero.
 
 resetCurrentTime ()
 Reset the stored current time.
 
 setCurrentTime ( $now)
 Set the time to be used as the current time.
 

Detailed Description

Writers gather a batch of increment operations and then commit them when flush() is called, or when the writer is destroyed.

Since
1.39

Definition at line 11 of file WRStatsWriter.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\WRStats\WRStatsWriter::__construct ( StatsStore $store,
$specs,
$prefix )
Access: internal
Parameters
StatsStore$store
array$specs
string | string[]$prefix

Definition at line 30 of file WRStatsWriter.php.

◆ __destruct()

Wikimedia\WRStats\WRStatsWriter::__destruct ( )

Commit the batch of increment operations.

Definition at line 117 of file WRStatsWriter.php.

References Wikimedia\WRStats\WRStatsWriter\flush().

Member Function Documentation

◆ flush()

Wikimedia\WRStats\WRStatsWriter::flush ( )

Commit the batch of increment operations.

Definition at line 107 of file WRStatsWriter.php.

Referenced by Wikimedia\WRStats\WRStatsWriter\__destruct().

◆ incr()

Wikimedia\WRStats\WRStatsWriter::incr ( $name,
?EntityKey $entity = null,
$value = 1 )

Queue an increment operation.

Parameters
string$nameThe metric name
EntityKey | null$entityAdditional storage key components
float | int$valueThe value to add

Definition at line 50 of file WRStatsWriter.php.

References $res.

◆ resetAll()

Wikimedia\WRStats\WRStatsWriter::resetAll ( ?array $entities = null)

Delete all stored metrics corresponding to the specs supplied to the constructor, resetting the counters to zero.

Parameters
EntityKey[] | null$entitiesAn array of additional storage key components. The default is the empty local entity.

Definition at line 128 of file WRStatsWriter.php.

References $keys.

◆ resetCurrentTime()

Wikimedia\WRStats\WRStatsWriter::resetCurrentTime ( )

Reset the stored current time.

In a long-running process this should be called regularly to write new results.

Returns
void

Definition at line 92 of file WRStatsWriter.php.

◆ setCurrentTime()

Wikimedia\WRStats\WRStatsWriter::setCurrentTime ( $now)

Set the time to be used as the current time.

Parameters
float | int$now

Definition at line 82 of file WRStatsWriter.php.


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