Template fragment caching with nested templates

Hi, I am currently testing template fragment caching (s. my earlier question). My project has a base template which caches everything except for the CSRF-protected searchbox

{% load cache %}
{% cache 900 head %}
...
{% endcache %}
# CSRF-protected searchbox comes here
{% cache 900 main requested_page.id %}
...
{% endcache %}

My template for search results is derived from the base template, and I struggle to configure the results template such that the main section is not cached.

I tried embedding the cache template tag in a regular block

{% block mainstart %}{% cache 900 main requested_page.id %}{% endblock %}
{% block mainend %}{% endcache %}{% endblock %}

so I could leave that block empty in the results template, but this threw an error (expected endcache instead of endblock). Is there a way to avoid caching the main section for search results while keeping the nested template setup?

I found the solution by nesting the {% cache %} tag entirely in a {% block %} tag:

{% block main %}
{% cache 900 main requested_page.id %}
...
{% endcache %}
{% endblock main %}

Performance increased by 62%.