示例#1
0
文件: Sqlite.php 项目: Jir4/Cache
 /**
  * Check if SQLite is loaded, else an exception is thrown.
  *
  * @param   array  $parameters    Parameters.
  * @return  void
  * @throws  \Hoa\Cache\Exception
  */
 public function __construct(array $parameters = [])
 {
     if (!extension_loaded('sqlite')) {
         throw new Cache\Exception('SQLite is not loaded on server.', 0);
     }
     parent::__construct($parameters);
     return;
 }
示例#2
0
文件: Apc.php 项目: Jir4/Cache
 /**
  * Check if APC is loaded, else an exception is thrown.
  *
  * @param   array   $parameters    Parameters.
  * @return  void
  * @throws  \Hoa\Cache\Exception
  */
 public function __construct(array $parameters = [])
 {
     if (!extension_loaded('apc')) {
         throw new Cache\Exception('APC (PECL extension) is not loaded on server.', 0);
     }
     parent::__construct($parameters);
     return;
 }
示例#3
0
文件: Memcache.php 项目: Jir4/Cache
 /**
  * Check if Memcache is loaded and prepare variables.
  *
  * @param   array  $parameters    Parameters.
  * @return  void
  * @throws  \Hoa\Cache\Exception
  */
 public function __construct(array $parameters = [])
 {
     if (!extension_loaded('memcache')) {
         throw new Cache\Exception('Memcache module extension is not loaded on server.', 0);
     }
     parent::__construct($parameters);
     return;
 }
示例#4
0
 /**
  * Check if EAccelerator is loaded, else an exception is thrown.
  *
  * @param   array   $parameters    Parameters.
  * @return  void
  * @throws  \Hoa\Cache\Exception
  */
 public function __construct(array $parameters = [])
 {
     if (!extension_loaded('eaccelerator')) {
         throw new Cache\Exception('EAccelerator is not loaded on server.', 0);
     }
     parent::__construct($parameters);
     return;
 }
示例#5
0
 /**
  * Validate that the Zend Platform is loaded and licensed.
  *
  * @param   array  $parameters    Parameters.
  * @return  void
  * @throws  \Hoa\Cache\Exception
  */
 public function __construct(array $parameters = [])
 {
     if (!function_exists('accelerator_license_info')) {
         throw new Cache\Exception('The Zend Platform extension must be loaded to use this backend.', 0);
     }
     if (!function_exists('accelerator_get_configuration')) {
         $licenseInfos = accelerator_license_info();
         throw new Cache\Exception('The Zend Platform extension is not loaded correctly: %s.', 1, $licenseInfos['failure_reason']);
     }
     $configurations = accelerator_get_configuration();
     if (@(!$configurations['output_cache_licensed'])) {
         throw new Cache\Exception('The Zend Platform extension does not have the proper license ' . 'to use content caching features.', 2);
     }
     if (@(!$configurations['output_cache_enabled'])) {
         throw new Cache\Exception('The Zend Platform content caching feature must be enabled to ' . 'use this backend, set the ' . 'zend_accelerator.output_cache_enabled directive to on.', 3);
     }
     if (!is_writable($configuration['output_cache_dir'])) {
         throw new Cache\Exception('The cache copies directory %s must be writable.', 4, $configuration['output_cache_dir']);
     }
     parent::__construct($parameters);
     return;
 }