thelia/smarty-cache-module

Installs: 101

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 7

Forks: 1

Open Issues: 0

Type:thelia-module

1.0.0 2015-11-28 19:58 UTC

This package is auto-updated.

Last update: 2024-11-14 22:37:24 UTC


README

A simple module to cache some parts of a template. It uses a smarty function.

Usage

The example will cache the generate code of a navigation menu. It will generate different caches depending of the current category, the lang and the currency. The cache will be used for 60 seconds, before being deleted :

{tcache key="navigation" ttl="60" category={category attr="id"}}
    <div class="navigation">
        {loop name="category-navigation" type="category" }
            ....
            <!-- other expensive loop -->
            ....
        {/loop}
    </div>
{/tcache}

Parameters

  • key : (mandatory) a unique key
  • ttl : (mandatory) a time to live in seconds
  • lang : specific cache by lang, possible values : on, off (default: on)
  • currency : specific cache by currency, possible values : on, off (default: on)
  • customer : specific cache by customer, possible values : on, off (default: off)
  • admin : specific cache by administator, possible values : on, off (default: off)
  • role : specific cache by role (none, customer, admin), possible values : on, off (default: off)

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