<p dir="auto"><strong>Symfony version(s) affected</strong>: 3.4.9 onwards</p>
<p dir="auto"><strong>Description</strong><br>
This bug, which seems to be introduced in Cache component's version 3.4.9 does not invalidate cache by tags. How to reproduce / possible solution can be found at Stack overflow thread: <a href="https://stackoverflow.com/questions/50290019/symfony-doesnt-remove-cache-by-tags" rel="nofollow">https://stackoverflow.com/questions/50290019/symfony-doesnt-remove-cache-by-tags</a></p>
<table role="table">
<thead>
<tr>
<th>Q</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bug report?</td>
<td>yes</td>
</tr>
<tr>
<td>Feature request?</td>
<td>no</td>
</tr>
<tr>
<td>BC Break report?</td>
<td>no</td>
</tr>
<tr>
<td>RFC?</td>
<td>no</td>
</tr>
<tr>
<td>Symfony version</td>
<td>^4.0</td>
</tr>
</tbody>
</table>
<p dir="auto">I am using the <code class="notranslate">TagAwareAdapter</code> so I can invalidate my REDIS cache by tag. The problem is that, while the cache item gets invalidated, this change does not persist between requests.</p>
<p dir="auto">See this reproduction <a href="https://github.com/Loupax/CachingTagInvalidationBug">repo</a> , it has four commands:<br>
One that populates the cache, one that invalidates the cache by tag, one that fetches the keys and one that does all three in a single command.</p>
<p dir="auto">Expected behaviour:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ bin/console app:add
$ bin/console app:invalidate
$ bin/console app:get"><pre class="notranslate"><code class="notranslate">$ bin/console app:add
$ bin/console app:invalidate
$ bin/console app:get
</code></pre></div>
<p dir="auto">The final command should output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="item-0, isHit:false
item-1, isHit:false
item-2, isHit:false
item-3, isHit:false
item-4, isHit:false"><pre class="notranslate"><code class="notranslate">item-0, isHit:false
item-1, isHit:false
item-2, isHit:false
item-3, isHit:false
item-4, isHit:false
</code></pre></div>
<p dir="auto">Actual output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="item-0, isHit:true
item-1, isHit:true
item-2, isHit:true
item-3, isHit:true
item-4, isHit:true"><pre class="notranslate"><code class="notranslate">item-0, isHit:true
item-1, isHit:true
item-2, isHit:true
item-3, isHit:true
item-4, isHit:true
</code></pre></div>
<p dir="auto">Running the command <code class="notranslate">$ bin/console app:add-invalidate-and-get</code> works as expected</p>