示例#1
0
 /**
  * Create a new file cache store instance.
  *
  * @param   array  $options
  * @return  void
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     if (!self::isAvailable()) {
         throw new RuntimeException('Cannot use WinCache cache storage. WinCache extension is not loaded.');
     }
 }
示例#2
0
 /**
  * Create a new file cache store instance.
  *
  * @param   array  $options
  * @return  void
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     $this->apcu = function_exists('apcu_fetch');
     if (!self::isAvailable()) {
         throw new RuntimeException('Cannot use Apc cache storage. Apc extension is not loaded.');
     }
 }
示例#3
0
 /**
  * Create a new file cache store instance.
  *
  * @param   array  $options
  * @return  void
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     if (!isset($this->options['chmod'])) {
         $this->options['chmod'] = null;
     }
     $this->directory = $this->cleanPath($this->options['cachebase']);
     if (!is_dir($this->directory)) {
         mkdir($this->directory, 0775);
     }
     if (!is_dir($this->directory) || !is_readable($this->directory) || !is_writable($this->directory)) {
         throw new RuntimeException('Cache path should be directory with available read/write access.');
     }
 }
示例#4
0
 /**
  * Create a new file cache store instance.
  *
  * @param   array  $options
  * @return  void
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     if (!self::isAvailable()) {
         throw new RuntimeException('Cannot use memcached cache storage. Memcached extension is not loaded.');
     }
     if (isset($this->options['engine'])) {
         $this->engine = $this->options['engine'];
     }
     if (!$this->engine) {
         if (!isset($this->options['servers']) || empty($this->options['servers'])) {
             $conf = new \Hubzero\Config\Repository('site');
             $this->options['servers'] = array(array('host' => $config->get('memcache_server_host', 'localhost'), 'port' => $config->get('memcache_server_port', 11211), 'weight' => 1));
         }
         $this->engine = $this->connect($this->options['servers']);
     }
 }
示例#5
0
 /**
  * Create a new file cache store instance.
  *
  * @param   array  $options
  * @return  void
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     if (!self::isAvailable()) {
         throw new RuntimeException('Cannot use CacheLite cache storage. CacheLite extension is not loaded.');
     }
     $this->directory = $this->cleanPath($this->options['cachebase']);
     if (!is_dir($this->directory) || !is_readable($this->directory) || !is_writable($this->directory)) {
         throw new RuntimeException('Cache path should be directory with available read/write access.');
     }
     if (isset($this->options['engine'])) {
         $this->engine = $this->options['engine'];
     }
     if (!$this->engine) {
         $cloptions = array('cacheDir' => $this->directory . DS, 'lifeTime' => isset($this->options['lifetime']) ? $this->options['lifetime'] : 15, 'fileLocking' => isset($this->options['locking']) ? $this->options['locking'] : false, 'automaticCleaningFactor' => isset($this->options['autoclean']) ? $this->options['autoclean'] : 200, 'fileNameProtection' => false, 'hashedDirectoryLevel' => 0, 'caching' => true);
         $this->engine = $this->getEngine($options);
     }
 }