LiteMage Configuration and Customization

LiteMage Cache implements caching on the whole Magento store and implement ESI blocks and events for contents which should not be cached. 

The default configuration is based on Magento's Demo Store and it is stored in a config.xml file at the following path:-
app/code/community/Litespeed/Litemage/etc/config.xml

The file contains comments for each configuration if you want to adjust them.

If you have a customized Magento setup, you may need to add additional ESI blocks and events there.


Block Type Denoted By "T:"

In previous versions of LiteMage you needed to explicitly change or add blocks that have been re-named by installed extensions. As of LiteMage 1.0.4, most custom blocks will be detected automatically by type.

For example, the "cart" block should look something like this:
<cart>
   <access>private</access>
   <blocks>T:Mage_Checkout_Block_Cart_Abstract</blocks>
   <purge_events>
     <sales_quote_save_after/>
   </purge_events>
 </cart>

Where instead of listing out each individual "cart" block by name in the <blocks> section, we use the type indicator prefix "T:" along with the inherited Magento class for "cart" type blocks to get "T:Mage_Checkout_Block_Cart_Abstract". Now any blocks that inherit this type will be automatically detected and included.


Purge Tags

Also new in LiteMage 1.0.4 are the inclusion of purge tags. These changes the block into a composite block that uses the combined purge events of other existing blocks without having to redefine those purge events in the block itself.

For example:
<toplinks>
  <access>private</access>
  <blocks>top.links</blocks>
  <purge_tags>cart, wishlist</purge_tags>
</toplinks>

Here the "top.links" block is using the purge tags "cart" and "wishlist" instead of explicitly re-listing these purge events for these blocks in a <purge_events> section. This will cause the "top.links" block to be purged whenever an event would cause either the "cart" or "wishlist" blocks to be purged.


Valueonly Blocks Denoted By "$v"

Marking a block as valueonly will keep the HTML tags and comments surrounding a value in an HTML text field from being output when in debug mode. This is important in keeping behavior consistent between viewing a page normally or in debug mode. Valueonly blocks will also not appear when using the "LITEMAGE_DEBUG=SHOWHOLES" parameter to highlight injected blocks on a page.

To mark a block as valueonly, use the suffix "$v". For example:
<welcome>
  <access>private</access>
  <blocks>welcome, litemage.jsvar,nickname$v</blocks>
</welcome>

Where the "nickname" block has been marked as valueonly.



Custom ESI Block Structure And Purge Events

Custom ESI Block Structure

ESI blocks are grouped by common purge events. If you feel as though none of the current groupings fit what you want to accomplish, you can add your own custom grouping to the <frontend><litemage><esiblock>section of LiteMage's "config.xml" file. The general structure for an ESI block is:
<Unique Group Tag>
  <access> ...  </access>
  <blocks> ... </blocks>
  <purge_events> ... </purge_events>
  <purge_tags> ... </purge_tags>
</Unique Group Tag>

Where:
<Unique Group Tag>: The unique name you want to assign this grouping.
<access>: Can be set to "public" or "private".
<blocks>: A combination of block types (where all blocks that inherit this type will automatically be included) and individual block names.
<purge_events>: A combination of events present in the <frontend><events> section that, when triggered, will cause this grouping of blocks to be purged.
<purge_tags>: A list of the "Unique Group Tags" of other ESI block groupings. The triggering of purge events for any grouping present in this list will also cause this grouping to also be purged.

Your custom grouping can either use purge events, purge tags, or both.


Custom Purge Events

If you would like to add additional purge events not currently present in LiteMage's "config.xml" file, you can do so by adding the event and its observer to the <frontend><events>section. The general structure for a purge event is:
<Magento Event Tag>
  <observers>
    <litemage_esi>
      <class>litemage/observer_esi</class>
      <method>purgeEsiCache</method>
    </litemage_esi>
  </observers>
</Magento Event Tag>

Where:-
<Magento Event Tag>: The name of a new existing Magento event not currently present in the <events> section.



Single Language Sites

LiteMage's "config.xml" file contains a rewrite for Magento's translate line to fix a bug. If you intend to only use a single language for your store, you may remove this rewrite for a possible performance improvement. The rewrite is located near the start of "config.xml" in <config><global><models>and will look like the following:
<core>
  <rewrite>
    <translate>Litespeed_Litemage_Model_Translate</translate>
  </rewrite>
</core>



Example: SM_Marketing Extension

If the SM_Marketing extension is being installed, the hole punching block name may have been changed by the extension. In this case, the default block name "minicart_head" should be changed to "mini-cartpro" to reflect changes made by the SM_Marketing extension.

The block should be the following:
<mini-cartpro>
...
</mini-cartpro>

For SNS extensions, "mini-cart" should be used instead.



When Changing LiteMage Configuration

In The Magento Admin Panel

After making any changes to LiteMage through the Magento Admin Panel, always Flush the LiteMage cache by navigating to System → Cache Management and, under "LiteMage Cache Management, clicking "Flush LiteMage Cache".


In The "config.xml" File

After Making any changes to LiteMage through it's "config.xml" file, you must do the following:

1. From the Magento Admin Panel, navigate to System → Cache Management.

2. Check the box next to "Configuration" and check that "Refresh" is selected in the drop-down menu on the top right before clicking "Submit".

3. Near the bottom of the page under "LiteMage Cache Management", click "Flush LiteMage Cache".



Important Note for Updating LiteMage Extension

Updating Magento LiteMage Extension will overwrite LiteMage's config.xml file.

Before you update, make sure to copy and save your config.xml file if you have made any customizations.


  • 21 Users Found This Useful
Was this answer helpful?

Related Articles

How To Setup LiteMage Cache

LiteMage Cache is the world's fastest Magento Full Page Cache. LiteMage Cache uses the LiteMage...

LiteMage Troubleshooting

LiteMage Cache Tips & Troubleshooting The Wiki page at LiteSpeed's website includes all Tips...