function session_cache_get in Session Cache API 6
Same name and namespace in other branches
- 8 session_cache.module \session_cache_get()
- 7 session_cache.api.php \session_cache_get()
- 7 session_cache.module \session_cache_get()
Read data from the user session, given its bin id.
Parameters
$bin:
File
- ./
session_cache.module, line 80 - session_cache.module
Code
function session_cache_get($bin) {
if (!isset($bin)) {
return NULL;
}
$method = variable_get('session_cache_storage_method', SESSION_CACHE_STORAGE_SESSION);
switch ($method) {
case SESSION_CACHE_STORAGE_COOKIE:
// Note that in array indices '.' are converted to '_'
return isset($_COOKIE['Drupal_session_cache_' . $bin]) ? unserialize($_COOKIE['Drupal_session_cache_' . $bin]) : NULL;
case SESSION_CACHE_STORAGE_DB_CORE:
$sid = session_cache_get_sid();
$cache = cache_get("{$bin}:{$sid}", 'cache_session_cache');
return is_object($cache) ? $cache->data : NULL;
case SESSION_CACHE_STORAGE_SESSION:
return isset($_SESSION) && isset($_SESSION[$bin]) ? $_SESSION[$bin] : NULL;
default:
return module_invoke_all('session_cache_get', $method, $bin);
}
}