Tutorials for Magento and Joomla! - Yireo

MageBridge caching

While you should enable Magento caching at all production sites, the caching ability of MageBridge can give your site even more performance. However, this performance gain is not as straightforward as caching in Magento. This whitepaper gives you more details.

Introducing MageBridge caching

Every time that you want to add a Magento block to your Joomla! site, MageBridge needs to fetch the data from Magento. This requires a HTTP connection to Magento, and the execution of the full Magento application. Especially the last part - starting up Magento - is costly and degrades the performance of your site. MageBridge allows you to cache a Magento block within Joomla!, which prevents that MageBridge needs to fetch that block from Magento.

Currently MageBridge allows for caching Magento blocks, the Magento headers and the Magento breadcrumbs. Caching the output of Joomla! modules is already offered by Joomla! so not implemented by MageBridge. So if you enable caching in MageBridge and you enable caching in Joomla!, you should be able to make full use of caching.

Enabling MageBridge caching

Within the MageBridge configuration, under the Other Settings tab you can find the option to enable caching. There is also an option to set the cache-time or TTL (Time-To-Live) - the amount of time after which a cache file will expire.

mb_joomla_cache_backend2

The problem of caching with Magento

However, MageBridge caching is only a benefit if MageBridge needs to fetch no other data from Magento. MageBridge allows caching of all blocks, but some blocks should not be cached at all - for instance, the shopping cart block, because it depends on user-specific data.

If your Joomla! page contains 4 blocks that can be cached, but also 1 block that can not be cached (like the cart-block), the performance benefit is gone: MageBridge still needs to fetch data from the other side, which means the initialization of Magento, which means a slower page-load.

So the only way caching can be made succesful, is if you tune every Joomla! page to include only Magento blocks that actually can be cached. There will be a few pages like the account-page or the cart-page that will never be cached by MageBridge, but tuning other pages (product-pages, catalog-pages) might give a huge speed boost.

Caching rules in MageBridge

When MageBridge caching is enabled, the Magento content-block (shown in the Joomla! component-area) will be cached, except on the following pages:

  • checkout/
  • customer/

At the moment all other blocks than the content-block are denied from caching. The reason for this is that only the content-block appears in the Joomla! component-area, while all other blocks appear in Joomla! modules - instead of using the MageBridge caching-ability, you can cache them using Joomla! caching.

Enabling Joomla! caching

Joomla! caching can be enabled in the Global Configuration. For more help with this, see the Joomla! Document Project. Do NOT enable the Joomla! System - Cache plugin: This offers full page caching, which is NOT useful for shopping sites.

mb_joomla_cache_backend3

When you enable caching in Joomla!, various parts of the Joomla! CMS can be cached. For each MageBridge module, you can tune a parameter Caching, and set it to Global (to use the setting of the Global Configuration) or to disable caching for that module.

mb_joomla_cache_backend4

AJAX lazy loading

Some of the MageBridge modules in Joomla! should never be cached, because they contain user-related information:

  • Shopping cart
  • Compare products
  • Checkout progress
  • Layered navigation
  • Recently viewed products

Because these modules should not be cached, they will slow down MageBridge-oriented pages - because MageBridge still needs to contact Magento before the actual page can be displayed. As a work-around you can also choose to load these Joomla! modules through AJAX.

This can be configured per Joomla! module by setting the option Module Layout to AJAX lazy-loading:

mb_joomla_cache_backend5

Cleaning the cache

Cache-files are stored in the Joomla! folder cache/com_magebridge, and with this, MageBridge caching is fully compliant with Joomla! caching. You can clean the cache through the Joomla! Cache Manager or by removing the physical folder on the filesystem.

mb_joomla_cache_backend1

Issue: System Messages

When using MageBridge caching, Magento messages will not be forwarded through the bridge. It's best to set the MageBridge option Enable System Messages to No. Also, other information that relies on feedback from MageBridge (for instance the MageBridgeTemplateHelper class) might be missing pieces of information as well. It is vital to check all pages throughly after enabling MageBridge caching.

Issue: Layered Navigation

With some types of Magento layered navigation, the pages are cached regardless of the setting made in that layered navigation. In those cases, MageBridge caching can not be used.

Still optimize Magento

While MageBridge caching allows some pages to be loaded faster, other pages are still being generated from Magento. We urge you to still put enough time in the performance optimization of Magento itself.

Created on Wednesday, 25 August 2010
Modified on Wednesday, 21 December 2011

About Yireo

Yireo tries to help webdevelopers build successful Joomla! and Magento sites.

More about Yireo