ShogunWarrior Posted January 3, 2007 Share Posted January 3, 2007 This is a cache theory I've been thinking about for a while but have never seen implemented.The basic theory is that at the top of the page there is a PHP-check (such as page age check) and if the page needs to be refreshed a script is run.E.g. The page [b]blog_post_2006_12_22_comments.php[/b] begins:[code]<?php$timestamp = 1167787321;if( ( time()-$timestamp )>30 ) { $file = 'blog_post_2006_12_22_comments.php'; include('refresh_cache.php'); }?>[/code]In refresh cache you could have any code but basically it would output the content of the file with the previous code prepended to it to check itself.Where I believe there is an advantage is that other than the very simple date check there is no overhead where you would normally have to load the contents of a file into a PHP string and then output it.However, I'm not sure if it is possible that the file will lock or will throw errors if it tries to rewrite the file (because it is being run). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.