Esempio n. 1
0
File: Cache.php Progetto: 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);
     }
 }
Esempio n. 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;
     }
 }
Esempio n. 3
0
 private function saveToCache()
 {
     Cacher::set(FEED_CACHE_KEY, $this->data, FEED_EXPIRE_TIME);
 }
Esempio n. 4
0
 private function markUpToDate()
 {
     if ($this->isRecentArticle()) {
         Cacher::set($this->upToDateKey, '1', ARTICLE_REFRESH_TIME);
     }
 }
Esempio n. 5
0
 private function saveToCache()
 {
     Cacher::set(INDEX_CACHE_KEY, $this->data, INDEX_EXPIRE_TIME);
 }
Esempio n. 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;
     }
 }