What effect, if any, does nesting cache tags have? It seems like it would be redundant, but are there any inherent drawbacks?
Recently, I can across an instance where I was using the {% cache %}
tag in an include to cache a large matrix field. This was very successful at reducing querries and speeding things up on several pages that used that same include.
But one template that included this file used more entries tags so it seemed to make sense to wrap all of them in a cache tag as well. Here's an example.
_includes/article-body.html
{% cache %}
{% for block in entry.bigMatrixField %}
...
{% endfor %}
{% endcache %}
blog/_entry.html
{% cache %}
{% for entry in craft.entries.section('blog') %}
...(some expensive queries)...
{% endfor %}
{% include "_includes/article-body" %}
{% for category in craft.categories.group('blogCategories') %}
...(some more expensive queries)...
{% endfor %}
{% endcache %}
blog/_entry.html
will load a cached version of_includes/article_body.html
and cache the whole once again.