I have some PHP code which looks roughly like this
require_once 'cache.php';
require_once 'generator.php';
if (cache_dirty ('foo')) {
cache_update ('foo', generate_foo ());
}
print cache_read ('foo');
My problem is that generator.php
includes a whole mass of libraries and I don't want to load/parse it unless cache_dirty
actually returns false
at runtime.
I know there are PHP precompilers which can help but for now I need a quick fix. Is this possible?
require_once 'cache.php';
if (cache_dirty ('foo')) {
require_once 'generator.php';
cache_update ('foo', generate_foo ());
}
print cache_read ('foo');
Fits your question quite well ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With