I'm sure it would work fine by using a map but what if 2000 users are logged in 
at the same time?
I think holding a map with 2000 sessionid's and user objects in memory is not 
cheap.

The situation is, even if I hold the user objects in a map, I would have to set 
the offline status
and update the modified user in the database. So this would be a part in both 
solutions.

The only question is:

a) holding a map with sessionid-user pairs. retrieve the proper user object 
from map. set offline status. udpate modified user in database.

vs.

b) retrieve the proper user object from database by searching the additional 
user table column "sessionid". set offline status. udpate modified user in 
database.

vs.

c) a different solution?

greetz





________________________________
Von: Bruno Borges <[EMAIL PROTECTED]>
An: [email protected]
Gesendet: Mittwoch, den 5. November 2008, 20:49:06 Uhr
Betreff: Re: session timeout and session id

How expensive do you think it will be to save and bring back the user object
from the database? I'm pretty sure that working with that information in
memory is faster and less expensive. Why not just staying with the Map
solution? I'm pretty sure it works.

cheers,
Bruno Borges
blog.brunoborges.com.br
+55 21 76727099

"The glory of great men should always be
measured by the means they have used to
acquire it."
- Francois de La Rochefoucauld


On Wed, Nov 5, 2008 at 1:31 PM, Arthur Leigh Allen <
[EMAIL PROTECTED]> wrote:

> Hello people!
>
> I know there are lots of threads with the same issue but I couldn't find a
> proper and well solved solution.
>
> I have a web application with users to login and logout.
> If a user logs in the user object is hold in the session.
> If the user logs out by using the logout button, the online status of this
> user is set to "offline" in the database.
>
> Well. My problem is the session timeout.
> If a session timeout occurs I only can access the session id of the expired
> session (am I right?).
> So I'm not able to access the user object anymore (?).
>
> Some of you showed a solution by holding a map or list in the application
> class, e.g. key (sessionid) and value (user).
> But I think it's expensive (memory).
>
> It would be more performant to save the session id of the user in the user
> database table when the user logs in.
> When the timeout occurs I could retrieve the user object from the database
> by using the unique session id.
> Then I could modify the user object and make it persistent again.
>
> Does anyone know a better way because I'm not fully satisfied with this
> solution, too?
>
> Best regards!
> Allen
>
>
>



      

Reply via email to