You are here

protected function MemoryCounterBackend::increaseCounter in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Cache/MemoryCounterBackend.php \Drupal\Core\Cache\MemoryCounterBackend::increaseCounter()
  2. 9 core/lib/Drupal/Core/Cache/MemoryCounterBackend.php \Drupal\Core\Cache\MemoryCounterBackend::increaseCounter()

Increase the counter for a function with a certain cid.

Parameters

string $function: The called function.

string $cid: The cache ID of the cache entry to increase the counter.

3 calls to MemoryCounterBackend::increaseCounter()
MemoryCounterBackend::delete in core/lib/Drupal/Core/Cache/MemoryCounterBackend.php
Deletes an item from the cache.
MemoryCounterBackend::get in core/lib/Drupal/Core/Cache/MemoryCounterBackend.php
Returns data from the persistent cache.
MemoryCounterBackend::set in core/lib/Drupal/Core/Cache/MemoryCounterBackend.php
Stores data in the persistent cache.

File

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

Class

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

Namespace

Drupal\Core\Cache

Code

protected function increaseCounter($function, $cid) {
  if (!isset($this->counter[$function][$cid])) {
    $this->counter[$function][$cid] = 1;
  }
  else {
    $this->counter[$function][$cid]++;
  }
}