You are here

private function FastCache::cache_load_ensure in Drupal driver for SQL Server and SQL Azure 8

Ensure cache binary is statically loaded.

3 calls to FastCache::cache_load_ensure()
FastCache::cache_clear_all in drivers/lib/Drupal/Driver/Database/sqlsrv/FastCache.php
cache_clear_all wrapper.
FastCache::get in drivers/lib/Drupal/Driver/Database/sqlsrv/FastCache.php
cache_get wrapper.
FastCache::set in drivers/lib/Drupal/Driver/Database/sqlsrv/FastCache.php
cache_set wrapper.

File

drivers/lib/Drupal/Driver/Database/sqlsrv/FastCache.php, line 116
fastcache class.

Class

FastCache
Static caching layer.

Namespace

Drupal\Driver\Database\sqlsrv

Code

private function cache_load_ensure($bin, $skiploadifempty = FALSE) {
  if (!isset($this->fastcacheitems[$bin])) {

    // If storage is enabled, try to load from cache.
    if ($this
      ->Enabled()) {
      if ($cache = $this->cache
        ->get($bin)) {
        $this->fastcacheitems[$bin] = new FastCacheItem($bin, $cache);
      }
      elseif ($skiploadifempty) {
        return;
      }
    }

    // If still not set, initialize.
    if (!isset($this->fastcacheitems[$bin])) {
      $this->fastcacheitems[$bin] = new FastCacheItem($bin);
    }

    // Register shutdown persistence once, only if enabled!
    if ($this->shutdown_registered == FALSE && $this
      ->Enabled()) {
      register_shutdown_function(array(
        &$this,
        'persist',
      ));
      $this->shutdown_registered = TRUE;
    }
  }
}