You are here

class CacheFactoryDefault in Drupal driver for SQL Server and SQL Azure 8.2

Hierarchy

Expanded class hierarchy of CacheFactoryDefault

1 file declares its use of CacheFactoryDefault
Connection.php in drivers/lib/Drupal/Driver/Database/sqlsrv/PDO/Connection.php

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Component/CacheFactoryDefault.php, line 5

Namespace

Drupal\Driver\Database\sqlsrv\Component
View source
class CacheFactoryDefault implements CacheFactoryInterface {

  /**
   * Unique prefix for this site/database
   *
   * @param string $prefix
   *   Unique prefix for this site/database
   */
  public function __construct($prefix) {
    $this->prefix = $prefix;
  }

  /**
   * Unique prefix for this database
   *
   * @var string
   */
  protected $prefix;

  /**
   * List of already loaded cache binaries.
   *
   * @var CacheInterface[]
   */
  protected $binaries = [];

  /**
   * {@inhertidoc}
   */
  public function get($bin) {
    $name = $this->prefix . ':' . $bin;
    if (!isset($this->binaries[$name])) {
      if (extension_loaded('wincache')) {
        $this->binaries[$name] = new CacheWincache($name);
      }
      elseif (function_exists("apcu_get")) {
        $this->binaries[$name] = new CacheApcu($name);
      }
      else {
        $this->binaries[$name] = new CacheStub($name);
      }
    }
    return $this->binaries[$name];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheFactoryDefault::$binaries protected property List of already loaded cache binaries.
CacheFactoryDefault::$prefix protected property Unique prefix for this database
CacheFactoryDefault::get public function {@inhertidoc} Overrides CacheFactoryInterface::get
CacheFactoryDefault::__construct public function Unique prefix for this site/database