You are here

public function ApcuRawBackend::counterGet in Supercache 8

Same name and namespace in other branches
  1. 2.0.x src/Cache/ApcuRawBackend.php \Drupal\supercache\Cache\ApcuRawBackend::counterGet()

Get the value of a counter variable.

Some backends do not store counters as numeric data. So if you call get($cid) you might obtain unexpected results.

Parameters

string $cid: The cache id.

Overrides CacheRawBackendInterface::counterGet

File

src/Cache/ApcuRawBackend.php, line 278
Contains \Drupal\supercache\Cache\ApcuRawBackend.

Class

ApcuRawBackend
Stores cache items in the Alternative PHP Cache User Cache (APCu).

Namespace

Drupal\supercache\Cache

Code

public function counterGet($cid) {
  if ($result = $this
    ->get($cid)) {
    return (int) $result->data;
  }
  return FALSE;
}