public function __construct($dir_storage) { parent::__construct(); $this->_dir_storage = $dir_storage; if (!file_exists($dir_storage) && !mkdir($dir_storage, 0755, true)) { throw new Exception("Failed to create cache storage directory [{$dir_storage}]."); } if (!is_dir($dir_storage) || !is_writable($dir_storage)) { throw new Exception("The [{$dir_storage}] is not writable directory. " . __CLASS__ . ' needs valid and writable directory to store cache items.'); } $s = "abcdef0123456789"; for ($i = 0; $i < strlen($s); $i++) { $subdir = $dir_storage . $s[$i]; if (!file_exists($subdir) && !mkdir($subdir)) { throw new Exception("Failed to create subdirectory [{$subdir}]."); } } $this->_stat['io_unlink'] = 0; $this->_stat['io_read'] = 0; $this->_stat['io_write'] = 0; $this->_stat['io_read_time'] = 0; $this->_stat['io_write_time'] = 0; $this->_stat['io_unlink_time'] = 0; $this->_stat['err_file_get_contents'] = 0; $this->_stat['err_file_put_contents'] = 0; $this->_stat['err_gzinflate'] = 0; $this->_stat['err_unserialize'] = 0; }
public function __construct() { parent::__construct(); $this->_stat['io_unlink'] = 0; $this->_stat['io_read'] = 0; $this->_stat['io_write'] = 0; $this->_stat['io_read_time'] = 0; $this->_stat['io_write_time'] = 0; $this->_stat['io_unlink_time'] = 0; if (APC_EXTENSION_LOADED === false) { throw new Exception('Failed to cache with APC. Please check if APC is enabled in phpinfo'); } }
public function __construct($host, $port) { parent::__construct(); $this->_stat['io_unlink'] = 0; $this->_stat['io_read'] = 0; $this->_stat['io_write'] = 0; $this->_stat['io_read_time'] = 0; $this->_stat['io_write_time'] = 0; $this->_stat['io_unlink_time'] = 0; $this->_memcache = new Memcache(); if ($this->_memcache->connect($host, $port) === false) { throw new Exception('Failed to connect to the memcached server'); } }
public function __construct($dir_storage, $cache_file_label) { parent::__construct(); $this->_dir_storage = $dir_storage; if (!file_exists($dir_storage) && !mkdir($dir_storage, 0755, true)) { throw new Exception("Failed to create cache storage directory [{$dir_storage}]."); } if (!is_dir($dir_storage) || !is_writable($dir_storage)) { _fatal(array("CODE" => "CORE_1002", "MESSAGE" => "The [{$dir_storage}] is not writable directory. Avactis needs valid and writable directory to store cache items.")); throw new Exception("The [{$dir_storage}] is not writable directory. " . __CLASS__ . ' needs valid and writable directory to store cache items.'); } $this->_file_storage = $dir_storage . '/' . $cache_file_label . '.single.cache'; $this->_stat['io_read'] = 0; $this->_stat['io_write'] = 0; $this->_stat['io_read_time'] = 0; $this->_stat['io_write_time'] = 0; $this->_loadFile(); }