Exemple #1
0
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (function_exists('apc_fetch')) {
         $this->is_apc = true;
     }
     $this->deleteExpired();
 }
Exemple #2
0
 public function __construct($options = array())
 {
     parent::__construct($options);
     $cache_host = str_replace('www.', '', JO_Request::getInstance()->getServer('HTTP_HOST'));
     $request_path = trim(JO_Request::getInstance()->getFullUri(), ' /');
     $request_path = str_replace(array('?', '&', ' '), '/', $request_path);
     $request_path = date('Y-m-d') . '/' . JO_Request::getInstance()->getController() . '/' . $request_path;
     $request_path = preg_replace('/([\\/]{2,})/', '/', $request_path);
     $request_path = trim($request_path, '/');
     $request_path = self::fixEncoding($request_path);
     //		var_dump($request_path); exit;
     if (strpos($request_path, '/') !== false) {
         $path = dirname($request_path) . '/';
         $tmp = explode('/', $request_path);
         $name = $this->clearString(end($tmp));
         $name = $name == 'index' ? $name . '.' . mt_rand(00, 5) : $name;
         $this->cache_name = $name . '.cache';
     } else {
         $path = '';
         $name = $this->clearString(trim($request_path) ? $request_path : 'home');
         $name = $name == 'index' ? $name . '.' . mt_rand(00, 5) : $name;
         $this->cache_name = $name . '.cache';
     }
     $folder = '';
     if (class_exists('WM_Currency')) {
         $folder = '/' . WM_Currency::getCurrencyCode();
     }
     //		$cache_folder = BASE_PATH . '/cache/' . $cache_host . '/' . JO_Locale::findLocale() . $folder . '/' . $path;
     $cache_folder = BASE_PATH . '/cache/' . $cache_host . '/' . $path;
     if (!file_exists($cache_folder) || !is_dir($cache_folder)) {
         if (!file_exists($cache_folder) || !is_dir($cache_folder)) {
             if (@mkdir($cache_folder, 0777, true)) {
                 $this->is_writable = true;
             }
         } else {
             $this->is_writable = true;
         }
     } elseif (is_writable($cache_folder)) {
         $this->is_writable = true;
     }
     $this->cache_dir = $cache_folder;
     $this->cache_path = BASE_PATH . '/cache/' . $cache_host . '/';
     $this->ignore_cache[] = 'vieworder';
     $this->ignore_cache[] = 'prices';
     $this->ignore_cache[] = 'cron';
     $this->ignore_cache[] = 'bulidUrl';
     $this->ignore_cache[] = 'latest_view';
     if (in_array(JO_Request::getInstance()->getController(), $this->ignore_cache)) {
         $this->is_writable = false;
     }
     if (in_array(JO_Request::getInstance()->getAction(), $this->ignore_cache)) {
         $this->is_writable = false;
     }
 }
Exemple #3
0
 public function __construct($options = array())
 {
     parent::__construct($options);
     ini_set('date.timezone', 'Europe/Sofia');
     $cache_folder = BASE_PATH . '/cache/' . JO_Request::getInstance()->getServer('HTTP_HOST') . '/mysql_cache/';
     if (!file_exists($cache_folder . 'data/') || !is_dir($cache_folder . 'data/')) {
         if (@mkdir($cache_folder . 'data/', 0777, true)) {
             $this->is_writable = true;
         }
     } else {
         if (is_writable($cache_folder . 'data/')) {
             $this->is_writable = true;
         }
     }
     $this->cache_dir = $cache_folder . 'data/';
     //$this->deleteExpired();
 }
Exemple #4
0
 public function __construct($options = array())
 {
     parent::__construct($options);
     $host = JO_Request::getInstance()->getDomain(true);
     $cache_folder = BASE_PATH . '/cache/' . $host . '/';
     if (!file_exists($cache_folder) || !is_dir($cache_folder)) {
         @mkdir($cache_folder, 0777, true);
     }
     if (file_exists($cache_folder) && is_dir($cache_folder) && is_writable($cache_folder)) {
         if (!file_exists($cache_folder . 'data') || !is_dir($cache_folder . 'data')) {
             if (mkdir($cache_folder . 'data', 0777, true)) {
                 $this->is_writable = true;
             }
         } else {
             $this->is_writable = true;
         }
     }
     $this->cache_dir = $cache_folder . 'data/';
     //$this->deleteExpired();
 }
Exemple #5
0
 /**
  * @param string $key
  * @return boolean
  */
 public function deleteExpired()
 {
     return self::$driver->deleteExpired();
 }
Exemple #6
0
 public function __construct($options = array())
 {
     parent::__construct($options);
     $this->install();
     $this->deleteExpired();
 }