Shopping Basket


 x 

Cart empty


Log In

Find Us Elsewhere

SSL

Forum Search

Keyword

We have introduced some improvements to the caching system for our Amazon plugin recently. This article explains how the caching system works, and applies to both the Amazon Shopping Cart, and the AmazonWS Joomla content plugin.

On the "Debugging Options" tab of the AmazonWS plugin there are two options that control the caching of Amazon results for both the plugin and the Amazon Shopping cart: Cache Time, and Max Cache Time.

Image5

Provided these are set to positive values, when the plugin tries to load some results from Amazon what happens is this:-

  1.  First of all, it checks the database for any cached results stored within the cache time, for example if you set a value of 10 for cache time, and there were results stored within the last 10 minutes, these results are used rather than making a new request to Amazon;
  2. If it cannot find cached results, then it tries a request to Amazon for a new set of results, if Amazon return some results these are used, and are also cached for future use;
  3. If it cannot get a response from Amazon, or the only result is an error message, then it looks again for some cached results, this time for any results stored before the max cache time, and uses those if they are available
  4. If no results at all are available, then you can see any error message that might be returned by turning on the "Show Error Messages" option in the plugin options, these can often be very informative
  5. Cached results that are older than the max cache time are automatically deleted

We have fixed an earlier issue that meant that results that were error messages could be cached, now this should not happen, only real results should be cached.

We hope that these improvements will solve most of the problems caused by Amazon throttling, while still allowing your site to show recent results. It makes sense to keep the cache time quite short, for example about 10 minutes, while the maximum time can be long, to ensure that some results should always be available to display. However the longer you make the maximum time, the more results will be stored in your database.

In practice it is probably not possible to prevent throttling issues from occuring occasionally, it is basically caused by Amazon wanting to protect its servers by preventing too many requests, but also insisting that you always show timely results. These two requirements are fundamentally incompatible and there is no technical trick that will stop this from being an issue 100% of the time, it can only be minimised as far as practical.

Cart Operations

The process described above applies to most requests such as item lookups, and searches. For obvious reasons it does not apply to cart operations, except for get cart operations, which fetch the current contents of the cart. When a customer makes a request which changes the contents of the cart, any cached versions are automatically deleted.

 Turning Off Caching

If you ever want to turn off caching, you can do this by setting the cache time to a negative number. There is also a "Clear Cache Now" button which does what it says.

Joomla Caching

The plugin is compatible with the Joomla caching system, and it is a good idea to use this as well. If you use the Joomla page cache plugin then you will need to exclude the cart page from being cached, but any other pages that show Amazon results can be cached.