Ejemplo n.º 1
0
 /**
  * Saves the object
  *
  * @param string $objectId
  * @param mixed  $object
  * @param int    $expiration If supported by the provider, this is used to specify the expiration
  *
  * @return bool
  */
 public function save($objectId, $object, $expiration = null)
 {
     if (null !== $expiration) {
         $this->adapter->setExpiration($expiration);
     }
     return $this->adapter->setItem($objectId, $object);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
 /**
  * save the content into an php file
  *
  * @param string $cacheId     The cache id
  * @param mixed  $content     The content to store
  * @param bool   $withVersion
  *
  * @return boolean whether the file was correctly written to the disk
  */
 public function setItem($cacheId, $content, $withVersion = true)
 {
     // Get the whole PHP code
     $data = array('content' => serialize($content));
     if ($withVersion) {
         $cacheId .= '.' . $this->getVersion();
     }
     // Save and return
     return $this->cache->setItem($cacheId, $data);
 }