/** * * @param string $name * @param mixed $value * @param string $key * @throws NotAuthenticatedException */ public function setSessionData($name, $value, $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)) { $oldData = []; } $oldData[$name] = $value; $this->session->set("user.{$key}.data", $oldData); }
/** * @param CacheItemInterface $item * @return bool|void */ public function save(CacheItemInterface $item) { if (!$item instanceof CacheItem) { throw new InvalidArgumentException('The cache item must be an implementation of \\ByJG\\Cache\\Psr\\CacheItem'); } if ($item->getExpiresInSecs() < 1) { throw new InvalidArgumentException('Object has expired!'); } $this->_cacheEngine->set($item->getKey(), $item->get(), $item->getExpiresInSecs()); $this->addElementToBuffer($item); return true; }