コード例 #1
0
 /**
  * UnLock resource after set it.
  * @param string $key
  */
 public function unlock($key)
 {
     $log = LogHandler::getInstance();
     $log->info("[Filesystem cache] Unlock '{$key}'");
     $lockFile = $this->fixKey($key) . ".lock";
     if (file_exists($lockFile)) {
         unlink($lockFile);
     }
 }
コード例 #2
0
 /**
  *
  * @param string $key
  * @param string $str
  * @return bool
  */
 public function append($key, $str)
 {
     $this->lazyLoadMemCachedServers();
     $log = LogHandler::getInstance();
     if (!CacheContext::getInstance()->getNoCache()) {
         $log->info("[Memcached] Append '{$key}' in Memcached");
         return $this->_memCached->append($key, $str);
     } else {
         $log->info("[Memcached] Not Set '{$key}' because NOCACHE=true");
     }
     return true;
 }
コード例 #3
0
 /**
  * Release the object
  * @param string $key
  */
 public function release($key)
 {
     $log = LogHandler::getInstance();
     $log->info("[Shmop Cache] release '{$key}'");
     if ($this->get($key) === false) {
         $log->info("[Shmop Cache] release '{$key}' does not exists.");
         return;
     }
     $filekey = $this->getKeyId($key);
     $shm_id = shmop_open($filekey, "w", 0, 0);
     $file = $this->getFTok($key);
     if (file_exists($file)) {
         unlink($file);
     }
     if ($shm_id) {
         shmop_delete($shm_id);
         shmop_close($shm_id);
         $log->info("[Shmop Cache] release '{$key}' confirmed.");
     }
 }