MediaWiki  1.23.2
StatCounter Class Reference

Aggregator for wfIncrStats() that batches updates per request. More...

Public Member Functions

 flush ()
 Flush all pending deltas to persistent storage. More...
 
 incr ( $key, $count=1)
 Increment a key by delta $count. More...
 

Static Public Member Functions

static singleton ()
 

Protected Member Functions

 __construct ()
 
 sendDeltasMemc (array $deltas)
 
 sendDeltasUDP (array $deltas)
 

Protected Attributes

Array $deltas = array()
 

Detailed Description

Aggregator for wfIncrStats() that batches updates per request.

This avoids spamming the collector many times for the same key.

Definition at line 38 of file StatCounter.php.

Constructor & Destructor Documentation

◆ __construct()

StatCounter::__construct ( )
protected

Definition at line 41 of file StatCounter.php.

Member Function Documentation

◆ flush()

StatCounter::flush ( )

Flush all pending deltas to persistent storage.

Returns
void

Definition at line 74 of file StatCounter.php.

References $deltas, array(), global, sendDeltasMemc(), and sendDeltasUDP().

Referenced by incr().

◆ incr()

StatCounter::incr (   $key,
  $count = 1 
)

Increment a key by delta $count.

Parameters
string$key
integer$count
Returns
void

Definition at line 61 of file StatCounter.php.

References $count, and flush().

◆ sendDeltasMemc()

StatCounter::sendDeltasMemc ( array  $deltas)
protected
Parameters
array$deltas
Returns
void

Definition at line 139 of file StatCounter.php.

References $count, $deltas, $wgMemc, as, global, and wfMemcKey().

Referenced by flush().

◆ sendDeltasUDP()

StatCounter::sendDeltasUDP ( array  $deltas)
protected
Parameters
array$deltas
Returns
void

Definition at line 92 of file StatCounter.php.

References $count, $deltas, $line, $lines, array(), as, global, wfRestoreWarnings(), wfSuppressWarnings(), and wfWikiID().

Referenced by flush().

◆ singleton()

static StatCounter::singleton ( )
static
Returns
StatCounter

Definition at line 46 of file StatCounter.php.

Member Data Documentation

◆ $deltas

Array StatCounter::$deltas = array()
protected

Definition at line 39 of file StatCounter.php.

Referenced by flush(), sendDeltasMemc(), and sendDeltasUDP().


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