1 theme.inc | public ThemeRegistry::set($data, $lock = TRUE) |
Writes a value to the persistent cache immediately.
Parameters
$data: The data to write to the persistent cache.
$lock: Whether to acquire a lock before writing to cache.
Overrides BackdropCacheArray::set
File
- core/
includes/ theme.inc, line 477 - The theme system, which controls the output of Backdrop.
Class
- ThemeRegistry
- Builds the run-time theme registry.
Code
public function set($data, $lock = TRUE) {
$lock_name = $this->cid . ':' . $this->bin;
if (!$lock || lock_acquire($lock_name)) {
if ($cached = cache($this->bin)->get($this->cid)) {
// Use array merge instead of union so that filled in values in $data
// overwrite empty values in the current cache.
$data = array_merge($cached->data, $data);
}
else {
$registry = $this->initializeRegistry();
$data = array_merge($registry, $data);
}
cache($this->bin)->set($this->cid, $data);
if ($lock) {
lock_release($lock_name);
}
}
}