Re: register_shutdown_function vs require (with pseudocode example)
| From: | Arpad Tamas | Date: | Wed, 20 Feb 2002 14:37:04 +0000 |
| Subject: | Re: register_shutdown_function vs require (with pseudocode example) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-85528@lists.php.net to get a copy of this message | ||
Hi,
No one has any idea on this topic? Or the question wasn't clear?
Thanks,
Arpi
> Hi again,
> I read my email back and found a little hard to understand :)), so
> I thought a code exmplae might help.
> It's just pseudo code for explaining how my cache works:
>
> //simplified "main" code
> if page is in cache {
> deliver the old one
> register_shutdown_function("regenerate")
> } else {
> regenerate()
> deliver
> }
>
> //registered shutdown function
> function regenerate() {
> if it's locked by another process {
> return
> } else {
> lock
> require_once(...);
> require_once(...);
> require_once(...);
> require_once(...);
> require_once(...);
> creation of many classes
> calling of many methods (the code is approx 1,6Megs)
> store
> unlock
> }
> }
> The main code delivers the page and reigsters the regenerate()
> function, and that's all what it should do. It takes about 0.04s,
> but this time unfortunately depends on what the regenerate()
> function does. If the page is locked then it finishes quickly (the
> overall time is 0.04s again), but when it can be regenerated it
> takes 0.25s. By the way the whole page regeneration takes 1.1s,
> that's why I really don't understand the 0.25s.
> I hope it was clearer with the two mails :)), and someone has an
> idea of whats happening here.
>
> Thanks for your help,
> Arpi