You are here

private static function fastcache::cache_load_ensure in Drupal driver for SQL Server and SQL Azure 7.2

Same name and namespace in other branches
  1. 7.3 sqlsrv/fastcache.inc \fastcache::cache_load_ensure()

Ensure cache binary is statically loaded.

3 calls to fastcache::cache_load_ensure()
fastcache::cache_clear_all in sqlsrv/fastcache.inc
cache_clear_all wrapper.
fastcache::cache_get in sqlsrv/fastcache.inc
cache_get wrapper.
fastcache::cache_set in sqlsrv/fastcache.inc
cache_set wrapper.

File

sqlsrv/fastcache.inc, line 118

Class

fastcache
Static caching layer.

Code

private static function cache_load_ensure($bin, $skiploadifempty = FALSE) {
  if (!isset(static::$fastcacheitems[$bin])) {

    // If storage is enabled, try to load from cache.
    if (static::Enabled()) {
      if ($cache = cache_get($bin, 'fastcache')) {
        static::$fastcacheitems[$bin] = new fastcacheitem($bin, $cache);
      }
      elseif ($skiploadifempty) {
        return;
      }
    }

    // If still not set, initialize.
    if (!isset(static::$fastcacheitems[$bin])) {
      static::$fastcacheitems[$bin] = new fastcacheitem($bin);
    }
  }
}