Re: object persistence within a session

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

 



On Fri, Nov 7, 2008 at 3:54 PM, Stan <stanleytberry@xxxxxxxxx> wrote:
> Andrew,
> Do I feel stupid!
> Thanks.

Welcome to the list. No need to feel stupid, and you're welcome. We
were all here at some point. Even tedd, who has been programming since
Rocks apparently. :-) At least you read up on the language and took a
stab at a solution before you came looking for help. That's a lot more
than can be said for some of the requests that show up on this list.

Just something to keep in mind based on your description of the
project. (You said you were trying to avoid repeated database calls on
each request.) PHP sessions are usually stored in the file system
(unlike ASP sessions that are stored in memory). Therefore there will
be some overhead with sessions as well. (The server has to read the
cookie, find the corresponding file, compare the modified time of the
file to make sure the session hasn't expired, read the file into
memory, and unserialize the data into variables.) You may want to
experiment from project to project while you're getting used to the
language until find the right balance of how much you store in
sessions versus how often you repeat trips to the database.

I usually use the database to store session information so that it is
available regardless of which server handles a request in a clustered
environment. I've found that I don't mind a few well organized
database calls per page for the information I need. I know some people
on this list have forgone sessions altogether in favor of other
approaches.

Andrew

-- 
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