Esempio n. 1
0
 /**
  *
  * @param string $name
  * @param string $key
  * @return mixed
  * @throws NotAuthenticatedException
  */
 public function getSessionData($name, $key = 'default')
 {
     if (!$this->isAuthenticated($key)) {
         throw new NotAuthenticatedException('There is no active logged user');
     }
     $oldData = $this->session->get("user.{$key}.data");
     if (!is_array($oldData)) {
         return false;
     }
     if (isset($oldData[$name])) {
         return $oldData[$name];
     }
     return false;
 }
Esempio n. 2
0
 /**
  * Psr implementation of getItem()
  * 
  * @param string $key
  * @return CacheItem
  */
 public function getItem($key)
 {
     // Get the element from the buffer if still remains valid!
     if (in_array($key, $this->bufferKeys)) {
         $cacheItem = $this->buffer[$key];
         if ($cacheItem->getExpiresInSecs() > 1) {
             return $cacheItem;
         }
     }
     // Get the element from the cache!
     $result = $this->_cacheEngine->get($key);
     $cache = new CacheItem($key, $result, $result !== null);
     $this->addElementToBuffer($cache);
     return $cache;
 }