Jump to content
Sign in to follow this  
enigma1

Cache HTML

Recommended Posts

The aim of this module is to utilize the browser's cache, thus reduces the page load times a visitor experiences as he browses through your store. Bandwidth usage is dramatically reduced. Cached pages are loaded from the user's browser hence the load times are subject to the local PC performance rather than the server response.

 

To maintain cart and personalized content integrity the module maintains a cached history per visitor with the session facility. The module also includes spider cacheing, cache reports and image cache.

 

Although is fairly easy to install you need to use caution configuring what scripts and under what conditions should be cached. See the configuration, Valdiation and Notes sections.

 

There are 5 different processes handled by the Cache HTML

  • Spiders cache
  • Full page cache for normal visitors
  • Parametric cache for normal visitors
  • Flush cached pages for normal visitors
  • Full image cache common for both spiders and visitors

Spiders cache - Caches all pages/scripts spiders can access for a defined period of time (osC Admin configurable)

 

Full page cache - Caches selected pages/scripts for normal visitors at the browser's end therefore subsequent clicks on the same page instantaneously load the page. (osC Admin configurable)

 

Parametric cache - Caches selected pages/scripts upto the point the user peforms an action that requires a get parameter passed. Typically pages with forms from the osc framework or product listing pages fall into this category. (osC Admin configurable)

 

Flush pages - Pages configured as flush invalidate the cache for the particular user identified via the session or cookie. The cache history when such a page/script is loaded is invalidated. (osC Admin configurable)

 

Image Cache - The image cache uses the OTF module from here 'On the Fly' Auto Thumbnailer using GD Library by Nate Welch 15 Dec 2005. The Cache Image functionality was appended at the top of this version along with minor mods. Is being enhanced to support cacheing at the browser's end. It is not configurable from osC Admin in its current form.

 

http://www.oscommerce.com/community/contributions,5029

Edited by enigma1

Share this post


Link to post
Share on other sites

After you Drako ;)

 

I was wondering what the difference between this and Chemo`s page cache is at all?

Share this post


Link to post
Share on other sites
Someone has used this so far? Working just good or what? Any feedback?

Well I do - obviously - with several stores. But you aren't looking for my feedback now, are you?

 

I was wondering what the difference between this and Chemo`s page cache is at all?

They're totally different. The one caches at the server's end, the other at the client's end. So the architecture, objectives and results are totally different.

Share this post


Link to post
Share on other sites
Well I do - obviously - with several stores. But you aren't looking for my feedback now, are you?

They're totally different. The one caches at the server's end, the other at the client's end. So the architecture, objectives and results are totally different.

 

I'd like to have you feedbak as well!


my contribution: Alex's Contributions

Share this post


Link to post
Share on other sites
I'd like to have you feedbak as well!

ok, apart of my personal opinion which is the module is great, superb etc... looking at the cache reports page the index.php and product_info.php cacheing show typically around 30% and 10% respectively.

 

This means for the index.php for instance on 100 visits:

30 hits and 70 misses.

these 30 hits signify the page was loaded by the browser. If one page say is 20KBytes then you have 20K x 30 hits = 600KBytes bandwidth savings on the index.php. and 20Kx10=200KBytes from the product info.php

 

Now typical values with stores with high traffic show arround 50,000 visits on the index.php daily. So 50,000 x 30% = 15,000 cache hits say 20KBytes per page, 300MB b/w savings daily (only from the index.php script). And that excludes images of course. With images, the cache results are by far greater, because the browser won't even request the image again.

 

So I believe you can get an idea from this figure what's going on.

Edited by enigma1

Share this post


Link to post
Share on other sites

Installed it on a heavily modified store and pleased to report it all works fine!

Thanks for your efforts Mark!!!!!!!!

Share this post


Link to post
Share on other sites
After you Drako ;)

 

I was wondering what the difference between this and Chemo`s page cache is at all?

 

I have installed this contribution and so far am pleased to know it works. However my results are far less than enigma's 30%... so far my best being 16%, others only hitting the cache script as low as one out of 25, or 4%. But anything is good.

 

You can also note, or I would assume, this contribution works with Chemo's page cache - my installation did not interfere with any of the page cache scripts - simply an addition...

Share this post


Link to post
Share on other sites
I have installed this contribution and so far am pleased to know it works. However my results are far less than enigma's 30%... so far my best being 16%, others only hitting the cache script as low as one out of 25, or 4%. But anything is good.

 

You can also note, or I would assume, this contribution works with Chemo's page cache - my installation did not interfere with any of the page cache scripts - simply an addition...

 

There are several parameters you need to take into account with this module to determine its efficiency.

 

1. Store size in products, categories etc should be proportional to the time you allow this cache module to create the reports. So for example a store with 100 products will show initially better results than a store with 1000 products both having the same traffic.

2. SEO optimization plays a role because one can place links around the web (through advertising or link exchange or in directories etc) With such links this cache can be extremely efficient

3. Spiders are aware of the page expiration headers so expect a low percentage under that column. There is no point for a spider to hit the same page before expiration.

4. The way you configure the scripts in osc Admin really matters. Some stores for example may always require the visitor to go through the product info page in order to add a product to the cart. While other stores use forms or links where you can directly add a product to the cart. Just one link with a parameter configured from the admin can invalidate the cache of the visitor's history to maintain the personalized content.

5. Also depends on what products you carry and the type of visitors your store attracts. A store for instance that shows an faq page for shipping details can show higher efficiency as visitors may go back and forth between the products page and FAQ page.

 

And many more...So this gives an idea of the complexity there is, to obtain the cache results. But overall the higher the efficiency you see with the cache HTML, the more efficient your store is.

Share this post


Link to post
Share on other sites

i notice in the instructions it informs you to make your selection on flush, cache, etc for infoboxes based on if that infobox requires updates such as user info, cart contents, etc....

 

does that mean that the page will cache, say its product_info, minus those infoboxes if set to flush and cache/parametric for product_info?

 

Im asking because I use banners/advertisements..

 

also, ive got additional infoboxes in seperate subfolders for me to easily locate... what changes need to be made to look in those folders?

 

thx

~t

Share this post


Link to post
Share on other sites
i notice in the instructions it informs you to make your selection on flush, cache, etc for infoboxes based on if that infobox requires updates such as user info, cart contents, etc....

Not infoboxes, it utilizes the browser's cache for entire pages. So the list of scripts you see is from the root folder of oscommerce.

 

does that mean that the page will cache, say its product_info, minus those infoboxes if set to flush and cache/parametric for product_info?

Im asking because I use banners/advertisements..

It will cache the entire page on the browser till the visitor selects one of the conditions configured in osc Admin to flush it. So clicking the same product in the product info page without doing anything like buy-now, write a review etc.. will show the same content exactly. Once he clicks add to cart the cache is flushed (with the default configuration instructions)

 

Banners advertisements, random content etc remains as is for new pages. But for a cached page the content is retrieved by the browser. The cache is per visitor. So what visitor-A sees as a banner may not be the same as what visitor-B sees.

Share this post


Link to post
Share on other sites

My stats show no script hits. I have supertracker module installed; could this be the problem?

Share this post


Link to post
Share on other sites
My stats show no script hits. I have supertracker module installed; could this be the problem?

If they don't show any numbers and you went through the configuration as documented it means you did not install it properly.

Share this post


Link to post
Share on other sites
If they don't show any numbers and you went through the configuration as documented it means you did not install it properly.

 

it shows numbers. All the numbers are under miss.

Share this post


Link to post
Share on other sites
it shows numbers. All the numbers are under miss.

 

ok, then make sure under the osc Admin->Cache Manager->cache configuration both Enable HTML Cache switches are set to true. Post your catalog\includes\application_top.php and a link (if this is online) to one of the pages that is configured to be cached or parametric so I can see.

Share this post


Link to post
Share on other sites

Hello enigma1 ! Thank you for the effort of making this script. I am not someone who understands what he is doing with PHP

I just playing around with a shop.

I've installed this contribution and I have

Warning: Division by zero in c:\program files\easyphp1-8\www\admin\includes\classes\split_page_results.php on line 33

 

it's appears in HTML Cache and Cache Report files.

I found that relevant part of those files is

<?php
// Get Scripts info from the database
$rows = 0;
$cache_html_query_raw = "select cr.*, c.cache_html_type from " . TABLE_CACHE_HTML_REPORTS . " cr left join " . TABLE_CACHE_HTML . " c on (c.cache_html_key = cr.cache_html_key) order by cr.cache_html_script";
$cache_html_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_HTML_CACHE_SCRIPTS, $cache_html_query_raw, $cache_html_query_numrows, 'cr.cache_html_key');
if( $cache_html_query_numrows > 0 ) {
?>

 

I shop script with latest updates and I really do not know where to start looking up.

Can you please help me with this, I guess, minor problem. Thank you again

Misha

Share this post


Link to post
Share on other sites
Hello enigma1 ! Thank you for the effort of making this script. I am not someone who understands what he is doing with PHP

I just playing around with a shop.

I've installed this contribution and I have

Warning: Division by zero in c:\program files\easyphp1-8\www\admin\includes\classes\split_page_results.php on line 33

 

it's appears in HTML Cache and Cache Report files.

I found that relevant part of those files is

<?php
// Get Scripts info from the database
$rows = 0;
$cache_html_query_raw = "select cr.*, c.cache_html_type from " . TABLE_CACHE_HTML_REPORTS . " cr left join " . TABLE_CACHE_HTML . " c on (c.cache_html_key = cr.cache_html_key) order by cr.cache_html_script";
$cache_html_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_HTML_CACHE_SCRIPTS, $cache_html_query_raw, $cache_html_query_numrows, 'cr.cache_html_key');
if( $cache_html_query_numrows > 0 ) {
?>

 

I shop script with latest updates and I really do not know where to start looking up.

Can you please help me with this, I guess, minor problem. Thank you again

Misha

 

Looks like the MAX_DISPLAY_HTML_CACHE_SCRIPTS is 0. Goto osc Admin->Cache Manager->Configuration->Number of scripts to show per page and make sure is set to a valid value. You did import the database for Cache HTML right?

Share this post


Link to post
Share on other sites

Thank you for the reply.

The SQL file attached to the contribution has a typo (for my humble opinion )

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function) VALUES ('Number of scripts to show per page', 'MAX_DISPLAY_HTML_CACHE_SCRIPTS', '64', 'Number of script entries to display per page', '22', '4', now(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),');

 

I have changed use_function and function to NULL

 

and when I disabled Chemo's page_cache it's got right.

 

I have this warning and also SQL error when configuration_cache (Chemo) - enabled

so now I can play with it.

Share this post


Link to post
Share on other sites

Update to previous post: I added manually values to config_cache file ( it didn't catch when I hit update on HTML configuration)

 

so now configuration_cache enabled and HTML cache appears without warnigs

Share this post


Link to post
Share on other sites
Update to previous post: I added manually values to config_cache file ( it didn't catch when I hit update on HTML configuration)

 

so now configuration_cache enabled and HTML cache appears without warnigs

Yes there is a mistake with that configuration line in the sql file, I will update it with the next version.

 

Thanks for that.

 

And if you have bobby's sql cache you need to clear it after importing new configuration lines to the database (otherwise they will take effect when the sql cache expires).

Share this post


Link to post
Share on other sites

Hi Mark,

 

I already have the latest version of "On the Fly" Auto Thumbnailer installed. Do I still need to replace the whole function tep_image() in catalog/includes/functions/html_output.php with the code included in your contrib?

 

Please advise.

 

Thank You.

Share this post


Link to post
Share on other sites
Hi Mark,

 

I already have the latest version of "On the Fly" Auto Thumbnailer installed. Do I still need to replace the whole function tep_image() in catalog/includes/functions/html_output.php with the code included in your contrib?

 

Please advise.

 

Thank You.

 

If you want to have cache with the thumbnails yes you do need to replace it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×