Related Topics

[Video CMS v4]html caching  (Read 1471 times) Print

1 B

dtiberio  May 19, 2014, 02:11:09 PM

I am not sure how you are doing your page generation, but it is obvious that the html is not being cached. its fine for a low traffic site, but once it becomes popular you will have to cache html pages.

for example, you have this sidebar nav bloc which starts like this:
<div class="sidebar-nav blc"><div class="head"><h4>Video Channels</h4></div>

if you get 50,000 hits per day, unless the admin adds or deletes channels, this html will always be the same. so it is better to store the nav block as an html file on the hard drive, and then reload it from the hard drive the next time you need it, as long as it isn't more than a certain age such as 24 hours or 15 minutes or whatever.

so you do this:

if (html file exists in disk cache and age < 30 minutes)
load and use html file from disk (use a key to determine which filename it is)

generate HTML as usual from database query
save a copy to the disk cache (using key specified in load routine)

with 2 simple changes (load the disk cache and save the disk cache) you increase page loading performance, page generation, and decrease db usage considerably.

then you have to do this with all of the HTML content on the site that is generate from database queries, including search results for popular searches.

right now the site is slow at times and this will help fix the problem.


dtiberio  May 19, 2014, 02:14:28 PM

here is an example of how to do it in PHP (I use a different language)

keep in mind he is doing caching of the entire page, but you can't do that because you have custom pages for each user (such as how it says Admin at the header of the page)

so you can only cache the html portion that is shared among all users


Alexander  May 21, 2014, 02:50:02 PM

You can use
if(!is_user()) {cache it}