I'm trying to make some kind of caching system that first delivers 
the old page, and then regenerate the new one "in the background". I 
achieved this with register_shutdown_function(). The registered 
function starts the real work, the normal php script just delivers 
the old page (of course if it were generated into the cahce before).
In the normal part of the program I required only the needed files to 
make the cache faster. It worked fine in older releases of php (maybe 
4.0.4, 4.0.5 I don't remember), but now 4.0.6 seems to include the 
files even if they aren't needed, and it slows down my cache. Without 
the requires (I commented out them) it delivers a page in avg 
0.04sec, but with the requires it's only 0.25 and it's too much for a 
The requires are called in the registered function, so they shouldn't 
affect the normal code. What is more interesting that it depends on 
the flow of the registered php code. For example if the page that 
should be regenarated is locked by another process and it can't be 
regenerated "in the backround" the cache delivers the page fast 
(0.04s), but if it's not locked (it can be regenerated) the cache 
becomes slow again (0.25s).
So what I don't understand: why the flow of the php code that is 
registered with register_shutdown_function affects the normal code's 
run? In theory it runs only when the normal code finished and the 
connection is released, and doesn't have anything to do with the 
normal script (that's why I started to use this method of caching).

(4.1.x is worse in this case because of bug #15209, it doesn't 
release the connection while the registered function is running)

Thanks for your help,

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

Reply via email to