コード例 #1
0
 public function retrieve()
 {
     if (SEO_URLS_ENABLED != 'false') {
         $query = str_replace(':cache_name', $this->cachename, $this->extract_query);
         $result = usu::query($query);
         $row = tep_db_fetch_array($result);
         tep_db_free_result($result);
         if (!empty($row)) {
             $cache_seconds = usu::$cachedays * 24 * 60 * 60;
             if (time() > strtotime($row['cache_date']) + $cache_seconds) {
                 $this->gc();
             } else {
                 usu::$cachefile_size = number_format(strlen($row['cache_data']) / 1024, 2) . ' kb';
                 usu::$performance['time'] = microtime(true);
                 $this->md5check = md5($row['cache_data']);
                 $rawdata = gzinflate(base64_decode($row['cache_data']));
                 usu::$registry = unserialize($rawdata);
                 usu::$performance['time'] = round(microtime(true) - usu::$performance['time'], 4);
                 $this->retrieved = true;
                 return true;
             }
         }
     }
     usu::$registry = Usu_Registry::getInstance();
 }
コード例 #2
0
ファイル: Usu_Registry.php プロジェクト: digideskio/oscmax2
 public static function getInstance()
 {
     if (is_null(self::$_singleton)) {
         return self::$_singleton = new self();
     } else {
         return self::$_singleton;
     }
 }
コード例 #3
0
 public function retrieve()
 {
     if (SEO_URLS_ENABLED != 'false') {
         usu::$performance['time'] = microtime(true);
         if (false === ($rawdata = gzinflate(base64_decode($this->get($this->cachename))))) {
             return usu::$registry = Usu_Registry::getInstance();
         }
         usu::$cachefile_size = number_format(strlen($this->get($this->cachename)) / 1024, 2) . ' kb';
         usu::$registry = unserialize($rawdata);
         usu::$performance['time'] = round(microtime(true) - usu::$performance['time'], 4);
     }
 }
コード例 #4
0
 public function retrieve()
 {
     if (is_readable($this->cachpath) && SEO_URLS_ENABLED != 'false' && !$this->gc()) {
         usu::$cachefile_size = number_format(filesize($this->cachpath) / 1024, 2) . ' kb';
         usu::$performance['time'] = microtime(true);
         $this->md5check = md5(file_get_contents($this->cachpath));
         usu::$registry = unserialize(gzinflate(file_get_contents($this->cachpath)));
         usu::$performance['time'] = round(microtime(true) - usu::$performance['time'], 4);
         return true;
     }
     usu::$registry = Usu_Registry::getInstance();
 }