Cached template content not invalidating
When new elements are created, there’s no way for Craft to immediately know which template caches should be cleared. That’s where the Delete Stale Template Caches task comes in. It loops through all of your caches that included element queries, re-runs the queries, and checks to see if the new element is now included in the results.

There are two things to be aware of, though:


Your element query must happen inside the {% cache %} tag pair.

bad:

{% set entries = craft.entries.section('news').limit(3) %}
{% cache %}
    {% for entry in entries %}
        ...
    {% endfor %}
{% endcache %}

good:

{% cache %}
    {% set entries = craft.entries.section('news').limit(3) %}
    {% for entry in entries %}
        ...
    {% endfor %}
{% endcache %}

The cache querying is not immediate. After saving the entry you will see a little progress bar in the CP header. You need to wait until that has completed before your caches will be cleared.