public function SessionProxy_Storage_Cache::read in Session Proxy 7
Overrides SessionProxy_Storage_Interface::read
File
- lib/
SessionProxy/ Storage/ Cache.php, line 34
Class
- SessionProxy_Storage_Cache
- Storage implementation based upon a specific cache backend.
Code
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;
}
}