public function FastCache::set in Drupal driver for SQL Server and SQL Azure 8
cache_set wrapper.
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ FastCache.php, line 152 - fastcache class.
Class
- FastCache
- Static caching layer.
Namespace
Drupal\Driver\Database\sqlsrvCode
public function set($cid, $data, $bin = NULL) {
$this
->FixKeyAndBin($cid, $bin);
$this
->cache_load_ensure($bin);
if ($this->fastcacheitems[$bin]->changed == FALSE) {
$this->fastcacheitems[$bin]->changed = TRUE;
// Do not lock if this is an atomic binary ($cid = $bin).
if ($cid === $bin) {
$this->fastcacheitems[$bin]->persist = TRUE;
//$this->fastcacheitems[$bin]->locked = FALSE;
}
else {
// Do persist or lock if it is not enabled!
if ($this
->Enabled()) {
// Hold this locks longer than usual because
// they run after the request has finished.
// if (function_exists('lock_acquire') && lock_acquire('fastcache_' . $bin, 120)) {
$this->fastcacheitems[$bin]->persist = TRUE;
// $this->fastcacheitems[$bin]->locked = TRUE;
//}
}
}
}
$this->fastcacheitems[$bin]
->data_set($cid, $data);
}