You are here

function drupal_session_destroy_uid in Memcache Storage 7

Ends a specific user's session(s).

Parameters

$uid: User ID.

File

includes/session.inc, line 486
User session handling functions.

Code

function drupal_session_destroy_uid($uid) {

  // Nothing to do if we are not allowed to change the session.
  if (!drupal_save_session()) {
    return;
  }

  // Destroy all sessions.
  $current_sessions = MemcacheStorageAPI::get($uid, 'sessions_map');
  if (is_array($current_sessions)) {
    foreach ($current_sessions as $sid) {
      MemcacheStorageAPI::delete($sid, 'sessions');
    }
    MemcacheStorageAPI::delete($uid, 'sessions_map');
  }
}