Fetch All Active Users Session


How can I read all user id (and other data) that are logged ?

I am developing an admin panel and I want to trace all the active users (like a CMS does)


Sessions shouldn’t be read that way. Use a common cache to save info about user presence and refresh it on their activity.

Is there a common Yii way to do that?

I don’t think there is a generic solution ready.

Use a cache component to hold an array indexed by user id. If a user logs in, add him to the array and set the value to the current timestamp. On each user activity reset that value.

Before displaying that info remove entries with timestamps older than a set period.

I try to avoid the ‘reinvent the wheel’

so, if I do not find another and sort way I implement that (thanks)

If anyone has another suggestion or experience, please let post it :)