public function ApcuRawBackend::counter in Supercache 8
Same name and namespace in other branches
- 2.0.x src/Cache/ApcuRawBackend.php \Drupal\supercache\Cache\ApcuRawBackend::counter()
Add an increment (can be negative) to the stored cache data. Only works for stored numeric data.
Parameters
string $cide: The cache ID or array of ID's.
int $increment: The amount to increment or decrement.
int $default: Default value.
Overrides CacheRawBackendInterface::counter
1 call to ApcuRawBackend::counter()
- ApcuRawBackend::counterMultiple in src/
Cache/ ApcuRawBackend.php - Add an increment (can be negative) to the stored cache data. Only works for stored numeric data.
File
- src/
Cache/ ApcuRawBackend.php, line 237 - Contains \Drupal\supercache\Cache\ApcuRawBackend.
Class
- ApcuRawBackend
- Stores cache items in the Alternative PHP Cache User Cache (APCu).
Namespace
Drupal\supercache\CacheCode
public function counter($cid, $increment, $default = 0) {
$success = FALSE;
$key = $this
->getApcuKey($cid);
apcu_inc($key, $increment, $success);
if (!$success) {
if (apcu_exists($key)) {
throw new \Exception("Counter failed.");
}
$this
->apcSet($this
->getApcuKey($cid), $default, CacheRawBackendInterface::CACHE_PERMANENT);
}
}