I\'m having trouble figuring out how I can count the number of logged-in users in my application.
What I have: When a user logs in, they get a sessi
Just to offer another solution:
if ($user->isLoggedIn()) { touch("/writable/path/loggedInUsers/" . $user->id); }
If you don't need to query this data, a local file touch is far faster than a DB write. To get logged in users, scan the directory for filemtimes under N seconds old.