Body: <p>I realise this is probably a duplicate of the other questions just like it but I thought I'd raise it here before filing a bug with P&amp;T. </p>
  
  <p>Basically, when a new entry is added to a section, the template cache isn't invalidating. Here is the template in question, is there anything in the code that would cause this? </p>
  
  <pre><code>    {% extends "_layouts/two-col" %}
  
      {% block main %}
  
          {% cache unless not craft.config.cache %}
  
          {{entry.body}} 
  
          {% set cutoffDate = now|date_modify('- ' ~ '1' ~ ' days') %}
          {% set events = craft.entries.section('whatsOn').order('dateStart') %}
  
          {% set eventIds = [] %}
          {% for event in events if (event.dateEnd ? event.dateEnd : event.dateStart) &gt;= cutoffDate %}
            {% set eventIds = eventIds|merge([event.id]) %}
          {% endfor %}
  
          {% set allEvents = craft.entries.id(eventIds).fixedOrder('true') %}
  
          {% paginate allEvents.limit(12) as events %}
  
          &lt;ul class="list list--articles"&gt;
  
              {% for event in events %}
  
                  &lt;li class="item" itemscope itemtype="http://schema.org/Event"&gt;
  
                      &lt;header class="item__header"&gt;
  
                          &lt;div class="item__meta"&gt;
  
                              &lt;time itemprop="startDate" content="{{event.dateStart}}" datetime="{{event.dateStart}}"&gt;{{event.dateStart|date("jS F Y")}}&lt;/time&gt;
  
                              {% if event.dateEnd|length %}
                                  — &lt;time itemprop="endDate" content="{{event.dateStart}}" datetime="{{event.dateStart}}"&gt;{{event.dateEnd|date("jS F Y")}}&lt;/time&gt;
                              {% endif %}
  
                          &lt;/div&gt;
  
                          &lt;h3 class="item__title h4" itemprop="name"&gt;&lt;a href="{{ event.url }}" class=""&gt;{{ event.title }}&lt;/a&gt;&lt;/h3&gt;
  
                          &lt;div class="item__type"&gt;
                              &lt;span class="tag tag--{{event.eventType|slugify}}"&gt;{{event.eventType}}&lt;/span&gt;
                              &lt;span itemprop="location" itemscope itemtype="http://schema.org/Place"&gt; {{event.location}}&lt;/span&gt;
                          &lt;/div&gt;
  
                      &lt;/header&gt;
  
                      &lt;div class="item__description"&gt;
                          &lt;a href="{{ event.url }}"&gt;Find out more&lt;/a&gt;
                      &lt;/div&gt;
  
                  &lt;/li&gt;
  
              {% endfor %}
  
          &lt;/ul&gt;
  
  
          {% if paginate.totalPages &gt; 1 %}
  
              &lt;nav class="nav nav--pagination"&gt;
  
                  &lt;ul class="nav__list"&gt;
  
                  {# &lt;a href="{{ paginate.firstUrl }}"&gt;First Page&lt;/a&gt; #}
              {# {% if paginate.prevUrl %}&lt;a href="{{ paginate.prevUrl }}"&gt;Previous Page&lt;/a&gt;{% endif %} #}
  
              {% for page, url in paginate.getPrevUrls(5) %}
                &lt;li class="nav__item"&gt;
                  &lt;a href="{{ url }}" class="nav__link"&gt;{{ page }}&lt;/a&gt;
                &lt;/li&gt;
              {% endfor %}
  
              &lt;li class="nav__item nav__item--active"&gt;&lt;span class="nav__link"&gt;{{ paginate.currentPage }}&lt;/span&gt;&lt;/li&gt;
  
              {% for page, url in paginate.getNextUrls(5) %}
                  &lt;li class="nav__item"&gt;
                      &lt;a href="{{ url }}" class="nav__link"&gt;{{ page }}&lt;/a&gt;
                  &lt;/li&gt;
              {% endfor %}
  
             {#  {% if paginate.nextUrl %}&lt;a href="{{ paginate.nextUrl }}"&gt;Next Page&lt;/a&gt;{% endif %}
              &lt;a href="{{ paginate.lastUrl }}"&gt;Last Page&lt;/a&gt; #}
  
                  &lt;/ul&gt;
  
              &lt;/nav&gt;
  
          {% endif %}
  
          {% endpaginate %}
  
          {% endcache %}  
  
      {% endblock %}
  
      {% block sidebar %}
  
          {% include '_partials/newsletter-signup' with { grid:'false' } %}
  
          {% include '_partials/social' %}
  
      {% endblock %}
  </code></pre>
  
  <p>If this all looks normal, I guess it is a bug with Craft?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-20T02:18:16.410Z
Comments.Text: Looks like this is doomed to linger unless the problem magically fixes itself. I've had a similar issue with rather meaty sub-templates, but that doesn't seem relevant here. Would you mind adding your Craft version and clarifying what environment(s) are pertinent here, if only for posterity?
Comments.UserDisplayName: Matt Stein
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-27T09:24:57.107Z
Comments.Text: It appears this was fixed in a recent Craft update :)
Comments.UserDisplayName: hamishtaplin
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-03T12:02:25.087Z
Comments.Text: I'm actually still experiencing problems with this so not sure if it was indeed fixed.
Comments.UserDisplayName: hamishtaplin
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-31T03:07:55.307Z
Comments.Text: Can everyone confirm that this happens when using the `{% cache %}` tag in combination with the `{% paginate %}` tag and when creating a new entry?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-05T11:45:39.447Z
Comments.Text: Any updates on this issue, harmish?
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-09T13:53:28.690Z
Comments.Text: Kind of. P&T looked in to it but were unable to re-produce the problem reliably so it's not something that's going to be fixed in any sort of time-frame, as far as I can tell.
Comments.UserDisplayName: hamishtaplin
Tags: <cache>
Title: Cache not invalidating when new entry is created
ThreadText: # Cache not invalidating when new entry is created
  
  (Asked by: username_0 on 2015-01-19)
  
  I realise this is probably a duplicate of the other questions just like it but I thought I'd raise it here before filing a bug with P&T.
  
  Basically, when a new entry is added to a section, the template cache isn't invalidating. Here is the template in question, is there anything in the code that would cause this?
  
  ```
      {% extends "_layouts/two-col" %}
  
      {% block main %}
  
          {% cache unless not craft.config.cache %}
  
          {{entry.body}} 
  
          {% set cutoffDate = now|date_modify('- ' ~ '1' ~ ' days') %}
          {% set events = craft.entries.section('whatsOn').order('dateStart') %}
  
          {% set eventIds = [] %}
          {% for event in events if (event.dateEnd ? event.dateEnd : event.dateStart) >= cutoffDate %}
            {% set eventIds = eventIds|merge([event.id]) %}
          {% endfor %}
  
          {% set allEvents = craft.entries.id(eventIds).fixedOrder('true') %}
  
          {% paginate allEvents.limit(12) as events %}
  
          <ul class="list list--articles">
  
              {% for event in events %}
  
                  <li class="item" itemscope itemtype="http://schema.org/Event">
  
                      <header class="item__header">
  
                          <div class="item__meta">
  
                              <time itemprop="startDate" content="{{event.dateStart}}" datetime="{{event.dateStart}}">{{event.dateStart|date("jS F Y")}}</time>
  
                              {% if event.dateEnd|length %}
                                  — <time itemprop="endDate" content="{{event.dateStart}}" datetime="{{event.dateStart}}">{{event.dateEnd|date("jS F Y")}}</time>
                              {% endif %}
  
                          </div>
  
                          <h3 class="item__title h4" itemprop="name"><a href="{{ event.url }}" class="">{{ event.title }}</a></h3>
  
                          <div class="item__type">
                              <span class="tag tag--{{event.eventType|slugify}}">{{event.eventType}}</span>
                              <span itemprop="location" itemscope itemtype="http://schema.org/Place"> {{event.location}}</span>
                          </div>
  
                      </header>
  
                      <div class="item__description">
                          <a href="{{ event.url }}">Find out more</a>
                      </div>
  
                  </li>
  
              {% endfor %}
  
          </ul>
  
          {% if paginate.totalPages > 1 %}
  
              <nav class="nav nav--pagination">
  
                  <ul class="nav__list">
  
                  {# <a href="{{ paginate.firstUrl }}">First Page</a> #}
              {# {% if paginate.prevUrl %}<a href="{{ paginate.prevUrl }}">Previous Page</a>{% endif %} #}
  
              {% for page, url in paginate.getPrevUrls(5) %}
                <li class="nav__item">
                  <a href="{{ url }}" class="nav__link">{{ page }}</a>
                </li>
              {% endfor %}
  
              <li class="nav__item nav__item--active"><span class="nav__link">{{ paginate.currentPage }}</span></li>
  
              {% for page, url in paginate.getNextUrls(5) %}
                  <li class="nav__item">
                      <a href="{{ url }}" class="nav__link">{{ page }}</a>
                  </li>
              {% endfor %}
  
             {#  {% if paginate.nextUrl %}<a href="{{ paginate.nextUrl }}">Next Page</a>{% endif %}
              <a href="{{ paginate.lastUrl }}">Last Page</a> #}
  
                  </ul>
  
              </nav>
  
          {% endif %}
  
          {% endpaginate %}
  
          {% endcache %}  
  
      {% endblock %}
  
      {% block sidebar %}
  
          {% include '_partials/newsletter-signup' with { grid:'false' } %}
  
          {% include '_partials/social' %}
  
      {% endblock %}
  
  ```
  
  If this all looks normal, I guess it is a bug with Craft?
  
  **Tags:** cache
  
  > **Comments:**
  > **username_3**: Any updates on this issue, harmish?  
  > **username_0**: Kind of. P&T looked in to it but were unable to re-produce the problem reliably so it's not something that's going to be fixed in any sort of time-frame, as far as I can tell.  
  > **username_1**: Looks like this is doomed to linger unless the problem magically fixes itself. I've had a similar issue with rather meaty sub-templates, but that doesn't seem relevant here. Would you mind adding your Craft version and clarifying what environment(s) are pertinent here, if only for posterity?  
  > **username_0**: It appears this was fixed in a recent Craft update :)  
  > **username_0**: I'm actually still experiencing problems with this so not sure if it was indeed fixed.  
  > **username_2**: Can everyone confirm that this happens when using the `{% cache %}` tag in combination with the `{% paginate %}` tag and when creating a new entry?  
  
  ---
  
  ## 0 answers
  
  