You are here

public function MongodbSessionManager::delete in MongoDB 8

Ends a specific user's session(s).

Parameters

int $uid: User ID.

Overrides SessionManager::delete

File

mongodb_user/src/MongodbSessionManager.php, line 30
Contains \Drupal\mongodb_user\MongodbSessionManager.

Class

MongodbSessionManager

Namespace

Drupal\mongodb_user

Code

public function delete($uid) {

  // Nothing to do if we are not allowed to change the session.
  if (!$this->writeSafeHandler
    ->isSessionWritable() || $this
    ->isCli()) {
    return;
  }
  $this->mongo
    ->get('sessions')
    ->remove(array(
    'uid' => (int) $uid,
  ));
}