function MemoryCounterBackend::increaseCounter

Same name in other branches
  1. 9 core/lib/Drupal/Core/Cache/MemoryCounterBackend.php \Drupal\Core\Cache\MemoryCounterBackend::increaseCounter()
  2. 8.9.x core/lib/Drupal/Core/Cache/MemoryCounterBackend.php \Drupal\Core\Cache\MemoryCounterBackend::increaseCounter()
  3. 11.x 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
MemoryCounterBackend::get in core/lib/Drupal/Core/Cache/MemoryCounterBackend.php
MemoryCounterBackend::set in core/lib/Drupal/Core/Cache/MemoryCounterBackend.php

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]++;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.