RE: Destroying session data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> Okay, lemme see if I understand how it works. Even if it "sees" it as 
> garbage, it will not destroy it until the session has ended? or will 
> destroy when that time is reached? So can I set 
> session.gc_maxlifetime 
> to be a low number (e.g., 10 seconds) and it will still behave 
> appropriately? Currently, it's set to the default - 1440.
> 
Actually the way most garbage cleanup routines work, the session datastore
will be removed regardless of whether it is "in use" or not.  

Here comes the tricky stuff, if php has sent a page to the browser and has
satisfied your browsers request, and your user is reviewing the contents of
the page to decide his next action, as far as apache and php are concerned,
that users session is no longer "in use".  But, if in the process of
preparing that page, it was using sessions, it would have stamped the
session datastore with a new timestamp, so the garbage cleanup routine would
not consider it an old datastore and remove it.  If the user waits a long
time (longer than gc_maxlifetime in seconds) before doing something, when
someone else requests a page, their session could trigger a cleanup process
and your session could be deleted.

If your script is running, fetches the session datastore, and has not
reached the end of it's processing where it rewrites the datastore with
updated data and a new timestamp, if during that time the file is deleted,
no harm done since the save session routine of your script will make sure
the datastore is created and write stuff back into if from it's memory
image.  I guess that is what PHP would consider "in use", whereas your user
will consider the time he is mulling over his response as "in use", even if
he gets up to get a cup of coffee before responding.

Warren Vail

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux