Re: persistent storage in PHP
| From: | Greg Stark | Date: | Wed, 07 May 2003 22:47:42 +0000 |
| Subject: | Re: persistent storage in PHP | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146751@lists.php.net to get a copy of this message | ||
wbrown@arkie.net (Wendell Brown) writes:
> On 07 May 2003 18:34:06 -0400, Greg Stark wrote:
>
> >How do I cache data persistently across page calls? As near as I can tell all
> >the variable scopes in PHP terminate at the end of a page and the next page
> >starts with a clean slate.
>
> If you are dealing with forms, you can "store" data in hidden fields.
> Otherwise you might want to look into sessions.
Woah, I guess my question was ambiguous. I'm not talking about data persisting
from one page access to the next for a given user. I'm talking about data
persisting from one user to the next for a given web server process.
I'm talking about data that will be inserted into the template for every
single page access, so I don't want to add an extra database call. And data
that changes very infrequently, actually probably never once the site goes
live.
The solution we always used with mod_perl was just to declare a static hash
and do lazy memoizing of any values looked up in the database by stuffing them
in the hash. The next page access for the next user would check the hash first
before checking the database. When the values in the database changed the
values on the web site wouldn't update until the processes exited and new
processes were forked, which would take 10-15 minutes.
--
greg