You are here

public function DatabaseRawBackend::counterSet in Supercache 8

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

Set the value for a counter storage item.

On some backends you can actually simply call set() but others require to provide, for example, an ASCII representation of the value.

Parameters

string $cid: The cache id.

int $value: The value.

Overrides CacheRawBackendInterface::counterSet

2 calls to DatabaseRawBackend::counterSet()
DatabaseRawBackend::counterSetMultiple in src/Cache/DatabaseRawBackend.php
Set the value of counter variables in batch.
DatabaseRawBackend::doCounter in src/Cache/DatabaseRawBackend.php
doCounter: if the $cid already exists and is not numeric should throw an exception. If it does not exist, should be populated with the default value.

File

src/Cache/DatabaseRawBackend.php, line 428
Contains \Drupal\supercache\Cache\DatabaseRawBackend.

Class

DatabaseRawBackend
Defines a default cache implementation.

Namespace

Drupal\supercache\Cache

Code

public function counterSet($cid, $value) {
  $this
    ->set($cid, (int) $value);
}