예제 #1
0
 public function save(array $data)
 {
     if ($this->__testForApc() === false) {
         return false;
     }
     if (apc_add(parent::getName(), serialize($data), parent::getTimeToLive()) === false) {
         return false;
     }
     return true;
 }
예제 #2
0
 public function save(array $data)
 {
     if (apc_add(parent::getName(), serialize($data), parent::getTimeToLive()) === false) {
         # logging me hearties
         # logging me hearties
         $types = parent::getTypes();
         $urgency = parent::getUrgency();
         parent::writeLog($types['error'], $urgency['high'], 'Could not successfully save to cache', 'APC Cache info: ' . PHP_EOL . serialize(apc_cache_info()));
         return false;
     }
     return true;
 }
예제 #3
0
 public function testTimeToLive()
 {
     $query = (string) "select `timestamp` \n\t\tfrom `cache_query_times` \n\t\twhere `table`='" . parent::getName() . "'";
     if (($result = self::query($query)) === false) {
         return true;
     }
     $diff = (int) time() - $result[0]['timestamp'];
     if ($diff > parent::getTimeToLive()) {
         self::deleteFromCacheTimes();
         return false;
     }
     return true;
 }
예제 #4
0
 public function testTimeToLive()
 {
     if (file_exists(self::getFile()) === false) {
         ## if the file doesn't exist
         return false;
     }
     $fileStat = stat(self::getFile());
     $diff = time() - $fileStat['mtime'];
     if ($diff > parent::getTimeToLive()) {
         return false;
     }
     return true;
 }