Base Tag Library
Note: We have updated our folder structure in Neto 6 and this has not been updated on all tweaks yet. More info.

cache

Keyhole caching tag that improves site performance

Example

[%cache id:'uniqueid' type:'content'%]
    <p>[@sku@]</p>
[%/cache%]

Usage

Creating a cache tag around a block of content saves everything contained in that block to neto, meaning that dynamic tags or logic held within are only needed to be rendered once, before that result is then shown to every other use who calls that same block.

This block will then only be refreshed to reflect updates if either the cache is cleared from within the control panel or if the type is configured correctly, whenever the data tags within are updated in Neto.

Things to consider while implementing the cache tag

  • The maximum size of each cached snippet is 1MB (not including images and other assets)
  • Cached content should not include dynamic data such as customer details or cart details
  • Cached elements are updated hourly or whenever you refresh your cache
  • The type:'' parameter is required and must have a valid value (cannot be blank).

Caching inventory thumbnails

Caching thumbnails is one of the most cost effective caches you can apply within neto.

By using the [@inventory_id@] data tag for the cache tag we ensure that along side the appropriate type tag, each thumbnail has its own unique ID

In the sample below we cache a [%if%][%/if%] and store it to a thumbnail

[%cache type:'gallery' id:'[@inventory_id@]'%]
    [%if [@price@] > 100%]<p>Free shipping</p>[%/if%]
[%/cache%]

Caching menus

Caching CMS controlled menus

When using the menu tag to generate a menu that's statically defined via our CMS, you'll want to use the type:'menu' which will ensure that if you update the CMS menu, the system will automatically find & clear the cache for this tag.

Caching automatically generated content menus

When using either the content_menu or the now deprecated category_menu tags - you'll want to use the type:'cmenu' which will ensure that when any content in any content type is updated - the cache will be cleared to reflect the new category, blog, etc.

Note that if you are caching a menu that changes depending on the category you are on, for example, automatically being open when selected, you'll need a new ID for each state depending on the ID. The example below we use the [@config:current_category@] data tag to ensure a unique ID for each state of the menu.

[%cache type:'cmenu' id:'mainmenu-[@config:current_category@]'%]
    <p>[@name@]</p>
[%/cache%]

cache parameters

Name Options Description
id:'' String The ID of the cache, two cache tags with the same ID & type will conflict and only load the first result rendered. The same ID on two types of cache tags will act as individual cache tags
type:'' list, gallery, box, display, cmenu, menu By using types, this will enable specific behaivour within neto to refresh a cache tag if the data tags within are changed in neto. list, gallery, box, display, will change if their are inventory changes while cmenu will change if there are changes to the content & menu will change if you use the CMS "Edit menu" function.

3 related articles found: