You are here

public function DatabaseRawBackend::counterGet in Supercache 2.0.x

Same name and namespace in other branches
  1. 8 src/Cache/DatabaseRawBackend.php \Drupal\supercache\Cache\DatabaseRawBackend::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/DatabaseRawBackend.php, line 444
Contains \Drupal\supercache\Cache\DatabaseRawBackend.

Class

DatabaseRawBackend
Defines a default cache implementation.

Namespace

Drupal\supercache\Cache

Code

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