Open Koc opened 8 years ago
Yes that is correct, or you can combine them using IndexedChainingCacheStrategy
.
{% cache 'v1/summary' {time: 300} %}
So what actually is the bug / issue?
I am using IndexedChainingCacheStrategy+GenerationalCacheStrategy+Blackhole. The problem is ttl for GenerationalCacheStrategy is preconfigured inside constructor. So I cann't do something
{% cache 'v1/summary' {generational: {'id': article.id, '@ttl' => 100}} %}
I can create PR for ttl per block and tagging (#36). But what syntax do you prefer:
{% cache 'v1/summary' {generational: {'id': article.id, '@ttl' => 100. '@tags' => ['user-'~article.author.id]}} %}
{# or #}
{% cache 'v1/summary' {generational: {'id': article.id, '_ttl' => 100. '_tags' => ['user-'~article.author.id]}} %}
{# or #}
{% cache 'v1/summary' {generational: {'id': article.id} ttl 100 tags ['user-'~article.author.id] %}
or we can be inspired from https://craftcms.com/docs/templating/cache
The key is time
instead of ttl
or the other ones you mention. :+1:
An example of chaining: https://github.com/asm89/twig-cache-extension#setup-2
So if I'm correct this isn't a bug in the extension right?
This is a feature request, not bug
You can already set the ttl for a block by using (or chaining) the LifetimeCacheStrategy
.
I don't want use LifetimeCacheStrategy :). I need support per-block ttl for GenerationalCacheStrategy (as noticed in subject of this issue). Nevermind, I will create PR for this later.
There is no way set ttl for the block, only per cache strategy