Version beta 2 introduced new caching functionality to Z Weather, making it more robust and provide better performance overall.  This article explains how Z Weather uses its cache for storing weather data.

So what is caching? Caching is the temporary storage of data to improve web site performance. In the case of Z Weather, it retrieves weather data from the National Weather Service (NWS) in XML format and stores it in a file folder on the Joomla/Mambo server.  This local file folder is the Z Weather's cache.  Subsequent requests for weather data will read the data from this cache instead of retrieving it from the NWS each time.  Reading data from the cache is much quicker than retrieving it from the NWS server, making the Z Weather component or module display much quicker to a web user.


Eventually, the weather information stored in the cache becomes old or "stale", and fresh data must be retrieved from the NWS. As a default, the alert data is refreshed every 5 minutes and the forecast and current conditions are refreshed every 60 minutes.  This refresh is triggered by a user browsing the web site when the cache becomes stale (unless the cache is being refreshed by a cron job).  If the NWS server is down or under a heavy load (perhaps due to a major weather event), the XML data may not be readily available for download.  In this case, Z Weather will keep its cached data until the server is available again. It will retry at half the interval of the cache timeout (beginning in beta 2 and above).  For example, if after 60 minutes the forecast data was not able to be refreshed, it will retry every 30 minutes thereafter until it can retrieve the data.

Z Weather supports three products from the NWS: alerts, forecasts and observations (also called current condintions).  A cache file will be created for each of these products if they are being displayed for the location.  The administrator interface provides tools to monitor these cache files.  Icons for new, current and stale status are shown for each cache file.  Hovering over the icon shows the age of the cache file, and clicking on the icon will display the XML file.

Z Weather Caching Tips

  • The NWS recommends forecast and current observation XML files should be downloaded no less than 60 minutes apart.
  • To disable the cache (and retrieve the cache data from the NWS every time), set the cache timeout to zero.  This should only be done for testing purposes.