Skip to main content


The cache block uses the thelia.cache service.

You can add this block on static parts (menu, footer, …) of your site to improve the generation time of your web pages


In dev mode, the cache is disabled.


Parameter nameDescription
key(mandatory) a unique key to identify the cache
ttl(mandatory) a time to live in seconds
langSpecific cache by lang, (default: current lang id)
currencySpecific cache by currency, (default: current currency id)

You can also add as many arguments as you need. These arguments will be used to generate a unique key.



{cache key="my-cache" ttl=600}
... HTML or Smarty code ...

By customer

{cache key="my-cache" ttl=600 customer_id=$CUSTOMER_ID}
... HTML or Smarty code specific by customer ...

By admin

{cache key="my-cache" ttl=600 admin_id_=$ADMIN_ID}
... HTML or Smarty code specific by admin ...

Disable currency specific cache

{cache key="my-cache" ttl=600 currency"no"}
... HTML or Smarty code same for every currency ...

Conditional cache

You can disable the caching of a block without delete it. For this, you must specify a ttl to 0.

{$ttl = 600}
{if $myCondition}
{$ttl = 0}

{cache key="my-cache" ttl=$ttl}
... HTML or Smarty code ...