예제 #1
0
파일: Cache.php 프로젝트: jasny/Q
 /**
  * Save data into cache.
  * 
  * @param string $id    Cache id
  * @param mixed  $data  Data to put in the cache
  * @param int    $opt   Cache::% options
  */
 public function set($id, $data, $opt = 0)
 {
     $this->doSet($id, $data, $opt);
     if (isset($this->chainNext) && ~$opt & self::NOCASCADE) {
         $this->chainNext->set($data);
     }
 }
예제 #2
0
 public function set($key = '', $value = '', $duration = 0)
 {
     if ($this->aliasToRedis) {
         $myCacher = new Cacher($key, Cacher::STORAGE_REDIS);
         return $myCacher->set($value, $duration);
     } else {
         return false;
     }
 }
예제 #3
0
 private function saveToCache()
 {
     Cacher::set(FEED_CACHE_KEY, $this->data, FEED_EXPIRE_TIME);
 }
예제 #4
0
 private function markUpToDate()
 {
     if ($this->isRecentArticle()) {
         Cacher::set($this->upToDateKey, '1', ARTICLE_REFRESH_TIME);
     }
 }
예제 #5
0
 private function saveToCache()
 {
     Cacher::set(INDEX_CACHE_KEY, $this->data, INDEX_EXPIRE_TIME);
 }
예제 #6
0
 public function banipRemove($ipaddress)
 {
     if ($this->isMemoryCacheEnable()) {
         $myCacher = new Cacher(self::PHPIDS_BANNEDIP_KEY);
         $list = $myCacher->get();
         if (empty($list)) {
             return false;
         } else {
             $newlist = array();
             foreach ($list as $ip) {
                 if ($ip != $ipaddress) {
                     $newlist[] = $ip;
                 }
             }
             return $myCacher->set($newlist, 0);
         }
     } else {
         return false;
     }
 }