[Cache] fix logic for fetching tag versions on TagAwareAdapter

This commit is contained in:
David Maicher 2018-05-04 21:08:14 +02:00 committed by Nicolas Grekas
parent 278f40f48d
commit d3790cadcd
2 changed files with 7 additions and 0 deletions

View File

@ -345,6 +345,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R
foreach ($tagVersions as $tag => $version) {
$tags[$tag.static::TAGS_PREFIX] = $tag;
if ($fetchTagVersions || !isset($this->knownTagVersions[$tag])) {
$fetchTagVersions = true;
continue;
}
$version -= $this->knownTagVersions[$tag][1];

View File

@ -69,6 +69,12 @@ class TagAwareAdapterTest extends AdapterTestCase
$this->assertFalse($pool->getItem('i1')->isHit());
$this->assertFalse($pool->getItem('i3')->isHit());
$this->assertTrue($pool->getItem('foo')->isHit());
$anotherPoolInstance = $this->createCachePool();
$this->assertFalse($anotherPoolInstance->getItem('i1')->isHit());
$this->assertFalse($anotherPoolInstance->getItem('i3')->isHit());
$this->assertTrue($anotherPoolInstance->getItem('foo')->isHit());
}
public function testInvalidateCommits()