예제 #1
0
파일: Storage.php 프로젝트: mimmi20/wurfl
 /**
  * Acquires a lock so only this thread reloads the WURFL data, returns false if it cannot be acquired
  *
  * @return bool
  */
 public function acquireLock()
 {
     if ($this->adapter->hasItem(self::WURFL_LOCKED)) {
         return false;
     }
     return $this->save(self::WURFL_LOCKED, true);
 }
예제 #2
0
 /**
  * @param \Wurfl\Request\GenericRequest $request
  * @param \stdClass                     $info
  * @param string                        $uaFile
  * @param string                        $cacheId
  */
 private function save(GenericRequest $request, \stdClass $info, $uaFile, $cacheId)
 {
     // write out to disk for future requests that might have the same UA
     $this->writeUAFile($info, $uaFile);
     // add the user agent & hash to a list of already saved user agents
     // not needed. a performance hit.
     $this->addToUAList($request, $info);
     $this->cache->setItem($cacheId, $info);
 }
예제 #3
0
 /**
  * Flush the whole storage
  *
  * @return bool
  */
 public function flush()
 {
     return $this->cache->flush();
 }
예제 #4
0
 /**
  * Removes all entries from the Persistence Provider
  */
 public function clear()
 {
     $this->adapter->flush();
 }