Ejemplo n.º 1
0
 public function write($sessionId, $serializedData)
 {
     global $user;
     try {
         // For performance reasons, do not update the sessions table, unless
         // $_SESSION has changed or more than 180 has passed since the last update.
         if ($this->sessionDataHasChanged($sessionId, $serializedData)) {
             $cid = $this->getCid($sessionId);
             // Either ssid or sid or both will be added from $key below.
             $data = new stdClass();
             $data->uid = $this->uid;
             $data->session = $serializedData;
             $this->cacheBackend->set($cid, $data);
         }
         return TRUE;
     } catch (Exception $exception) {
         // FIXME: This should never be here, a global try/catch should definitely
         // be done upper in the code.
         require_once DRUPAL_ROOT . '/includes/errors.inc';
         // If we are displaying errors, then do so with no possibility of a further
         // uncaught exception being thrown.
         if (error_displayable()) {
             print '<h1>Uncaught exception thrown in session handler.</h1>';
             print '<p>' . _drupal_render_exception_safe($exception) . '</p><hr />';
         }
         return FALSE;
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function set($value)
 {
     /* @var CacheFragmentController $controller */
     $controller = entity_get_controller('cache_fragment');
     if (!$controller->createCacheFragments($this->cacheFragments)) {
         return;
     }
     $this->cacheObject->set($this->generateCacheId(), $value);
 }
 /**
  * WARNING: Tags will be ignored, sorry
  *
  * {inheritdoc}
  */
 public function setMultiple(array $items)
 {
     foreach ($items as $cid => $item) {
         $this->backend->set($cid, $item['data'], $item['expires'], $item['tags']);
     }
 }
 /**
  * Stores data in the persistent cache, respecting the use caches flag.
  *
  * @see \DrupalCacheInterface::set()
  */
 protected function cacheSet($cid, $data, $expire = CACHE_PERMANENT, array $tags = array())
 {
     if ($this->cacheBackend && $this->useCaches) {
         $this->cacheBackend->set($cid, $data, $expire, $tags);
     }
 }
Ejemplo n.º 5
0
 /**
  * Caches the builded container definition.
  *
  * @param array
  *   The container definition array.
  */
 protected function setCache(array $definition)
 {
     $this->cache->set($this->getCacheId(), $definition);
     $this->cachedDefinition = $definition;
 }
Ejemplo n.º 6
0
 function set($cid, $data, $expire = CACHE_PERMANENT)
 {
     $this->backend->set($cid, $data, $expire);
 }