With the development of HAMweather 4, output caching has been integrated into the code. It was decided that HAMweather 3 users could greatly benefit from the use of output caching as well, so the HW3Cacher script was developed.
The HW3Cacher script is used as a front end to the HW3php script and will cache its output. Then on future requests for the same URL, the data in the cache will be used, if not expired. For sites that receive multiple requests for the same data/locations within the max cache time, a huge saving in time and resources will be seen. In our testing a standard HW3 request may use 4MB of memory and take 1.3 seconds to display, but once cached with the HW3Cacher script, subsequent requests took less than 0.02 seconds to display and only used 0.25 to 0.5MB of memory. Though each individual user/server may experience different results based on server resources, network speeds and more.
The HW3Cacher script will allow you to set cache times based on the data being requested. This allows you to set a 10 minute cache time for a standard local forecast, but then a 1-2 minute cache time for the advisory pages. Additionally there is the ability to turn off caching for certain requests.
Note: The HW3Cacher will not cache a page that does not have forecast=xxxx or do=xxxx in the query string and the user has a HW3 cookie set. This is so that it does not cache the Cookie based "My Forecast" page, since the URL/Query String is the same for all users, but the output may be completely different.
This document can be found at the following locations:
Online HTML:
http://www.hamweather.com/hw3/docs/hw3php/HW3Cacher_php
PDF:
http://www.hamweather.com/hw3/docs/hw3php/HW3Cacher_php/HW3Cacher_php.pdf