|
Posted by Mikel Astiz on 09/27/05 12:09
Hi Erwin,
I'm afraid I haven't explained myself well (my english doesn't help much
either). I probably didn't explain the difference between PHP sessions and
my own application sessions (client/server architecture).
PHP sessions seem to be automatically handled by a garble collector. I
haven't changed anything there, as far as I know. I do want to handle my own
session mechanism, but I understand this would work over the PHP session.
So, basically, the only problem I have is that I wan't my own session to be
closed (DB updated) as soon as the PHP session is closed or timeouted.
Besides, your last explanation seems to be useful. It hadn't occurred to
me that another mechanism outside PHP (cron) could be used to detect the
invalid session entries and do the cleanup, even if no queries are made to
the server. Given that session ends apparently cannot be processed by some
kind of event handling, your approach seems to be the best alternative.
Thanks a lot,
Mikel
(And speaking about what I told to Collin, it's because I probably don't
understand the term 'session hanlder')
"Erwin Moller"
<since_humans_read_this_I_am_spammed_too_much@spamyourself.com> escribiσ en
el mensaje news:4337fbc8$0$11075$e4fe514c@news.xs4all.nl...
> 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]
|