Hello, I have what would otherwise be a simple request. I'd like to count the total number of authenticated users on the site, and I use this module for my sessions. I see the function sess_count() in the code with the note "not implemented." My current understanding is that the memcache session support is non-persistent (per #934706: DB writethrough for session information request to write-through to the DB.) So counting sessions in the database isn't going to be terribly helpful.
What do you recommend for this? It sounds like obtaining and counting all memcache objects is not ideal. Would that other issue be the ideal approach? Or would you recommend a different way to maintain a counter? I'd dovetail to the writethrough issue but I don't care as much about restarting the session, I just want to count.
Comment | File | Size | Author |
---|---|---|---|
#3 | memcache-session.inc_.patch | 4.11 KB | Jochus |
#2 | memcache-session.inc_.patch | 3.79 KB | Jochus |
Comments
Comment #1
yonailo CreditAttribution: yonailo commentedHello there,
I have applied the following hack to have sess_count functionality.
in the sess_write() function, I have added the following:
Then I have coded sess_count like this:
Hope this helps.
Comment #2
Jochus CreditAttribution: Jochus commentedGreat idea, but the problem is: your $anonymous_count and $authenticated_count arrays will grow, and grow, and grow. Right?
I think you need to unset the $sid, so you can just hit count() on the array?
Please look at my patch
Comment #3
Jochus CreditAttribution: Jochus commentedHmm, my previous patch isn't correct. My sess_count() doesn't look to the $timestamp argument. This is the better one
Comment #4
rjbrown99 CreditAttribution: rjbrown99 commentedPatch here, changing status.