/** * Check APC extension * * @param array $settings * @throws ComponentException */ public function __construct($settings = []) { if (!extension_loaded('apc')) { $msg = "APC extension not installed/enabled.\n Install and/or enable APC extension. See phpinfo() for more information"; throw new ComponentException($msg); } parent::__construct($settings); }
/** * Check and setup Redis server * * @param array $settings * @throws ComponentException * @throws ConfigurationException */ public function __construct($settings = []) { // check Redis extension if (!class_exists('\\Predis\\Client')) { throw new ComponentException("Predis library not found. Install Predis library [https://github.com/nrk/predis/wiki]"); } // check Redis settings if (!is_array($settings) || empty($settings)) { throw new ConfigurationException("Predis configuration is missed. Please check 'cache' configuration section"); } parent::__construct($settings); }
/** * Check and setup memcached servers * * @param array $settings * @throws ComponentException * @throws ConfigurationException */ public function __construct($settings = array()) { // check Memcached extension if (!extension_loaded('memcached')) { throw new ComponentException("Memcached extension not installed/enabled.\n Install and/or enable memcached extension. See phpinfo() for more information"); } // check Memcached settings if (!is_array($settings) or empty($settings) or !isset($settings['servers'])) { throw new ConfigurationException("Memcached configuration is missed. Please check 'cache' configuration section"); } parent::__construct($settings); }
/** * Check and setup Redis server * * @param array $settings * @throws ComponentException * @throws ConfigurationException */ public function __construct($settings = []) { // check Redis extension if (!extension_loaded('redis')) { throw new ComponentException("Redis extension not installed/enabled.\n Install and/or enable Redis extension [http://pecl.php.net/package/redis].\n See phpinfo() for more information"); } // check Redis settings if (!is_array($settings) || empty($settings)) { throw new ConfigurationException("Redis configuration is missed. Please check 'cache' configuration section"); } parent::__construct($settings); }
/** * Check configuration and permissions * * @param array $settings * @throws ConfigurationException */ public function __construct($settings = array()) { if (!isset($settings['cacheDir'])) { throw new ConfigurationException("FileBase adapters is required 'cacheDir' option"); } $cacheDir = $settings['cacheDir']; if (!is_dir($cacheDir)) { throw new ConfigurationException("'{$cacheDir}' is not directory"); } if (!is_writable($cacheDir)) { throw new ConfigurationException("Directory '{$cacheDir}' is not writable"); } // get rid of trailing slash $this->cacheDir = realpath($cacheDir); parent::__construct($settings); }