public function MemoryCounterBackend::getCounter

public MemoryCounterBackend::getCounter($method = NULL, $cid = NULL)

Returns the call counter for the get, set and delete methods.

Parameters

string $method: (optional) The name of the method to return the call counter for.

string $cid: (optional) The name of the cache id to return the call counter for.

Return value

int|array An integer if both method and cid is given, an array otherwise.

File

core/lib/Drupal/Core/Cache/MemoryCounterBackend.php, line 74

Class

MemoryCounterBackend
Defines a memory cache implementation that counts set and get calls.

Namespace

Drupal\Core\Cache

Code

public function getCounter($method = NULL, $cid = NULL) {
  if ($method && $cid) {
    return isset($this->counter[$method][$cid]) ? $this->counter[$method][$cid] : 0;
  }
  elseif ($method) {
    return isset($this->counter[$method]) ? $this->counter[$method] : array();
  }
  else {
    return $this->counter;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!MemoryCounterBackend.php/function/MemoryCounterBackend::getCounter/8.1.x