You are here

function session_cache_file_session_cache_get in Session Cache API 8

Same name and namespace in other branches
  1. 7 session_cache_file/session_cache_file.module \session_cache_file_session_cache_get()

Implements hook_session_cache_get().

File

session_cache_file/session_cache_file.module, line 70
session_cache_file.module

Code

function session_cache_file_session_cache_get($method, $bin) {
  if ($method != SESSION_CACHE_STORAGE_FILE) {
    return NULL;
  }
  $path = session_cache_file_directory($bin);
  $sid = session_cache_get_sid();
  $data = $path && $sid && file_exists("{$path}/{$sid}") ? unserialize(file_get_contents("{$path}/{$sid}")) : NULL;
  return $data;
}