physaux Posted November 3, 2009 Share Posted November 3, 2009 Hey guys, I was hoping someone here could advise me on a matter... I am going to have a website with roughly 300 pages, and they will have mostly static sections (unless a power user edits it, like wikipedia kind of), and some dynamic parts (like login area, time, notices, etc). I was wondering, do you think I should develop some sort of "cache" system, where I process the page everytime it is edited or 14 hours or what not, then when somebody loads it, I just "include" the cached data, and attach the dynamic php content. Would doing this be more efficient than generating the whole page from mysql for each user? Thanks! Link to comment https://forums.phpfreaks.com/topic/180126-efficiency-of-using-php-and-mysql-to-generate-page-vs-having-cached-copies/ Share on other sites More sharing options...
Mchl Posted November 3, 2009 Share Posted November 3, 2009 How much traffic do you expect to have? Link to comment https://forums.phpfreaks.com/topic/180126-efficiency-of-using-php-and-mysql-to-generate-page-vs-having-cached-copies/#findComment-950216 Share on other sites More sharing options...
physaux Posted November 3, 2009 Author Share Posted November 3, 2009 Well, I want it to be "scalable", but how much traffic, hmm I would say about 1.4 million views per day, spread out on 30,000 different pages. So about 50 view per page How is that? And how would I go about caching? Care to point me to a resource if it is apporpriate? thanks Link to comment https://forums.phpfreaks.com/topic/180126-efficiency-of-using-php-and-mysql-to-generate-page-vs-having-cached-copies/#findComment-950220 Share on other sites More sharing options...
physaux Posted November 3, 2009 Author Share Posted November 3, 2009 I found this code, anyone care to comment/ advise about it? <?php if ((is_file($_SERVER['SCRIPT_FILENAME'].'.cached')) && (time()-filemtime($_SERVER['SCRIPT_FILENAME'].'.cached') < 3600)) { readfile($_SERVER['SCRIPT_FILENAME'].'.cached'); exit; } // (the php script itself goes here) echo $out; $fp = fopen($_SERVER['SCRIPT_FILENAME'].'.cached', 'w'); fwrite($fp, $out); fclose($fp); ?> Thanks! Link to comment https://forums.phpfreaks.com/topic/180126-efficiency-of-using-php-and-mysql-to-generate-page-vs-having-cached-copies/#findComment-950232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.