/**
  * {@inheritdoc}
  */
 public function get()
 {
     $cid = $this->generateCacheId();
     $query = new \EntityFieldQuery();
     $count = $query->entityCondition('entity_type', 'cache_fragment')->propertyCondition('hash', $cid)->count()->execute();
     if ($count) {
         return $this->cacheObject->get($cid);
     }
     // If there are no cache fragments for the given hash then clear the cache
     // and return NULL.
     $this->cacheObject->clear($cid);
     return NULL;
 }
 /**
  * Fetches from the cache backend, respecting the use caches flag.
  *
  * @see \DrupalCacheInterface::get()
  */
 protected function cacheGet($cid)
 {
     if ($this->useCaches && $this->cacheBackend) {
         return $this->cacheBackend->get($cid);
     }
     return FALSE;
 }
 /**
  * Retrieves the cache id of the container definition.
  *
  * @return string
  *   The hardcoded cache id or via variable_get() if defined.
  */
 protected function getCache()
 {
     if (isset($this->cachedDefinition)) {
         return $this->cachedDefinition;
     }
     $cache = $this->cache->get($this->getCacheId());
     $this->cachedDefinition = FALSE;
     if (!empty($cache->data)) {
         $this->cachedDefinition = $cache->data;
     }
     return $this->cachedDefinition;
 }
示例#4
0
 public function read($sessionId)
 {
     global $user;
     if (!isset($_COOKIE[$this->sessionName])) {
         $user = drupal_anonymous_user();
         return '';
     }
     $cid = $this->getCid($sessionId);
     if ($cached = $this->cacheBackend->get($cid)) {
         $data = $cached->data;
         if ($data && $data->uid > 0) {
             $this->uid = $data->uid;
             $serializedData = $data->session;
         } else {
             $serializedData = '';
         }
         $this->sessionDataSetHash($sessionId, $serializedData);
         return $serializedData;
     } else {
         return NULL;
     }
 }
 /**
  * {inheritdoc}
  */
 public function get($cid, $allow_invalid = false)
 {
     return $this->backend->get($cid);
 }
示例#6
0
 function get($cid)
 {
     return $this->backend->get($cid);
 }