|
Posted by Erwin Moller on 09/26/05 16:46
Mikel Astiz wrote:
> That is exactly what I meant with 'polling', but I would also like to
> automatically "timeout" sessions even if no queries are made to the
> server. Maybe it would be necessary to add another page to do explicit
> cleanups?
>
> Mikel
Hi,
What I do not understand is this: You claim that you store your sessions in
a database, but have no clue how?
(I say this after reading your response to Collin in this thread.)
I mean: PHP stores sessions in files by default, and you have a setup that
stores them in a database: The only way that this could happen is that
somebody changed the sessionhandlers. Must be you. :-)
Are you sure you store your session in a database?
But that aside: To answer your question: when to delete the records?
Well, it depends what you call 'automatic'.
If you write a simple script that only executes one query every hour, is
that automatic? I think so. :-)
So how to do this?
1) Make a script that deletes old rows from your sessiontable.
2) Call this script
WHEN to call the script?
Two 'straight' solutions:
1) Make it a cronjob or something, and execute that job every hour or so.
2) Use your existing sessionhandler, and put the code in there.
But you do not have to clean up with every request to PHP, so that is why I
suggested the 'random-rule', like: do it every 100 requests.
Does this help?
Regards,
Erwin Moller
Navigation:
[Reply to this message]
|