src/AdminStoreInit.php
protected function store_get_user_status() {
		$this->init();
		if ($this->user_token === null)
			return null;
		if ($this->user_data !== null)
			return $this->user_data;

		$token = $this->user_token;

		# cache validation
		$cached = $this->store_redis_cache_read($token);
		if ($cached !== null) {
			if ($cached['uid'] == -1)
				# cached invalid session
				return null;
			# cached valid session
			return $this->user_data = $cached;
		}

		$expire = $this->store->stmt_fragment('datetime');
		$session = $this->store->query(
			sprintf(
				"SELECT * FROM v_usess " .
				"WHERE token=? AND expire>%s " .
				"LIMIT 1",
				$expire
			), [$token]);
		if (!$session) {
			# session not found or expired
			$this->store_reset_status();
			# cache invalid session for 10 minutes
			$this->store_redis_cache_write($token,
				['uid' => -1], null, 600);
			return $this->user_data;
		}

		if (!$this->redis)
			return $this->user_data = $session;

		$this->store_redis_cache_write($token, $session,
			$session['expire']);

		return $this->user_data = $session;
	}
protected function store_get_user_status() {
		$this->init();
		if ($this->user_token === null)
			return null;
		if ($this->user_data !== null)
			return $this->user_data;

		$token = $this->user_token;

		# cache validation
		$cached = $this->store_redis_cache_read($token);
		if ($cached !== null) {
			if ($cached['uid'] == -1)
				# cached invalid session
				return null;
			# cached valid session
			return $this->user_data = $cached;
		}

		$expire = $this->store->stmt_fragment('datetime');
		$session = $this->store->query(
			sprintf(
				"SELECT * FROM v_usess " .
				"WHERE token=? AND expire>%s " .
				"LIMIT 1",
				$expire
			), [$token]);
		if (!$session) {
			# session not found or expired
			$this->store_reset_status();
			# cache invalid session for 10 minutes
			$this->store_redis_cache_write($token,
				['uid' => -1], null, 600);
			return $this->user_data;
		}

		if (!$this->redis)
			return $this->user_data = $session;

		$this->store_redis_cache_write($token, $session,
			$session['expire']);

		return $this->user_data = $session;
	}
protected function store_get_user_status ( ) { $ this -> init ( ) ; if ( $ this -> user_token === null ) return null ; if ( $ this -> user_data !== null ) return $ this -> user_data ; $ token = $ this -> user_token ; # cache validation $ cached = $ this -> store_redis_cache_read ( $ token ) ; if ( $ cached !== null ) { if ( $ cached [ 'uid' ] == - 1 ) # cached invalid session return null ; # cached valid session return $ this -> user_data = $ cached ; } $ expire = $ this -> store -> stmt_fragment ( 'datetime' ) ; $ session = $ this -> store -> query ( sprintf ( "SELECT * FROM v_usess " . "WHERE token=? AND expire>%s " . "LIMIT 1" , $ expire ) , [ $ token ] ) ; if ( ! $ session ) { # session not found or expired $ this -> store_reset_status ( ) ; # cache invalid session for 10 minutes $ this -> store_redis_cache_write ( $ token , [ 'uid' => - 1 ] , null , 600 ) ; return $ this -> user_data ; } if ( ! $ this -> redis ) return $ this -> user_data = $ session ; $ this -> store_redis_cache_write ( $ token , $ session , $ session [ 'expire' ] ) ; return $ this -> user_data = $ session ; }
Populate session data.
Populate session data .