function ApcuBackend::set
Same name in other branches
- 9 core/lib/Drupal/Core/Cache/ApcuBackend.php \Drupal\Core\Cache\ApcuBackend::set()
- 8.9.x core/lib/Drupal/Core/Cache/ApcuBackend.php \Drupal\Core\Cache\ApcuBackend::set()
- 10 core/lib/Drupal/Core/Cache/ApcuBackend.php \Drupal\Core\Cache\ApcuBackend::set()
Overrides CacheBackendInterface::set
3 calls to ApcuBackend::set()
- ApcuBackend::invalidateAll in core/
lib/ Drupal/ Core/ Cache/ ApcuBackend.php - Marks all cache items as invalid.
- ApcuBackend::invalidateMultiple in core/
lib/ Drupal/ Core/ Cache/ ApcuBackend.php - Marks cache items as invalid.
- ApcuBackend::setMultiple in core/
lib/ Drupal/ Core/ Cache/ ApcuBackend.php - Store multiple items in the persistent cache.
File
-
core/
lib/ Drupal/ Core/ Cache/ ApcuBackend.php, line 173
Class
- ApcuBackend
- Stores cache items in the Alternative PHP Cache User Cache (APCu).
Namespace
Drupal\Core\CacheCode
public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = []) {
assert(Inspector::assertAllStrings($tags), 'Cache tags must be strings.');
$tags = array_unique($tags);
$cache = new \stdClass();
$cache->cid = $cid;
$cache->created = round(microtime(TRUE), 3);
$cache->expire = $expire;
$cache->tags = implode(' ', $tags);
$cache->checksum = $this->checksumProvider
->getCurrentChecksum($tags);
// APCu serializes/unserializes any structure itself.
$cache->serialized = 0;
$cache->data = $data;
// Expiration is handled by our own prepareItem(), not APCu.
apcu_store($this->getApcuKey($cid), $cache);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.