/** * Prepare the cache of the users.. */ public static function buildCache() { User::$cache = array(); User::$createCache = array(); User::$autoIncrement = 1 + DB::$DB->query("SELECT MAX(id) FROM users")->fetch()[0]; $users = User::getAll(); foreach ($users as $user) { $username = $user->username; $client_id = $user->client_id; if (!isset(User::$cache[$username])) { User::$cache[$username] = array(); } User::$cache[$username][$client_id] = $user; } }