Exemple #1
0
 /**
  * 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);
 }
Exemple #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);
 }
 /**
  * Flush the whole storage
  *
  * @return bool
  */
 public function flush()
 {
     return $this->cache->flush();
 }
Exemple #4
0
 /**
  * Removes all entries from the Persistence Provider
  */
 public function clear()
 {
     $this->adapter->flush();
 }