You are here

public function APDQCache::__construct in Asynchronous Prefetch Database Query Cache 7

Constructs a DrupalDatabaseCache object.

Parameters

string $bin: The cache bin for which the object is created.

Overrides DrupalDatabaseCache::__construct

File

./apdqc.cache.inc, line 272
Extends Drupal's default database cache so async queries happen.

Class

APDQCache
A pretty darn quick cache implementation of Drupal's default cache backend.

Code

public function __construct($bin) {

  // Load the correct database backend.
  $db_type = apdqc_fast_get_db_type();

  // Async queries are only available in PHP 5.3+.
  if ($db_type === 'mysql' && defined('PHP_VERSION_ID') && PHP_VERSION_ID >= 50300) {
    require_once 'apdqc.mysql.inc';
  }
  $this->compressed = $this
    ->apdqcCacheCompressBin($bin);
  if ($this->compressed) {
    $this->compression_level = $this
      ->apdqcCacheCompressionLevelBin($bin);
  }
  parent::__construct($bin);
}