function MemoryBackend::set
Same name in other branches
- 9 core/lib/Drupal/Core/Cache/MemoryBackend.php \Drupal\Core\Cache\MemoryBackend::set()
- 8.9.x core/lib/Drupal/Core/Cache/MemoryBackend.php \Drupal\Core\Cache\MemoryBackend::set()
- 11.x core/lib/Drupal/Core/Cache/MemoryBackend.php \Drupal\Core\Cache\MemoryBackend::set()
Overrides CacheBackendInterface::set
1 call to MemoryBackend::set()
- MemoryBackend::setMultiple in core/
lib/ Drupal/ Core/ Cache/ MemoryBackend.php - Store multiple items in the persistent cache.
2 methods override MemoryBackend::set()
- MemoryCache::set in core/
lib/ Drupal/ Core/ Cache/ MemoryCache/ MemoryCache.php - Stores data in the persistent cache.
- MemoryCounterBackend::set in core/
lib/ Drupal/ Core/ Cache/ MemoryCounterBackend.php - Stores data in the persistent cache.
File
-
core/
lib/ Drupal/ Core/ Cache/ MemoryBackend.php, line 116
Class
- MemoryBackend
- Defines a memory cache implementation.
Namespace
Drupal\Core\CacheCode
public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = []) {
assert(Inspector::assertAllStrings($tags), 'Cache Tags must be strings.');
$tags = array_unique($tags);
// Sort the cache tags so that they are stored consistently in the database.
sort($tags);
$this->cache[$cid] = (object) [
'cid' => $cid,
'data' => serialize($data),
'created' => $this->time
->getRequestTime(),
'expire' => $expire,
'tags' => $tags,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.