thelia/thelia — pull request #800 by bibich (2014-10-15 10:58:07+00:00)
Title: [WIP] Cache

This is a work in progress.

Initially started to improve performance of loops in template, but this is not so easy to implement. There is some works started but this is not conclusive. Caching is easy, but reverting the cache when it's needed is a challenge.

Otherwise, a new smarty plugin is available to cache the result of a fragment of a template. It's great when datas are not changing often or for expensive queries, ... you can easily configure dependency to lang, currency or user as the key of the cache entry is generated from the attributes of the smarty function. You can also specify the time to live of the entry with `ttl` argument :

``` smarty
{cache key="menu" category=$current_category_id lang={lang attr="id"} }
{menu parent='0'}
{/cache}
```

For now, 4 drivers are available : **Null** (no cache), **PHP Array** (not persistent), **FileSystem**, **Memcached**.

You can use the new service named `thelia.cache` to use the default cache manager or use the service `thelia.cache.factory` to use a custom cache mechanism.