Skip to content

Commit af32a38

Browse files
feature symfony#61127 [Cache] Add TagAwareAdapterInterface to NullAdapter (a.dmitryuk)
This PR was squashed before being merged into the 7.4 branch. Discussion ---------- [Cache] Add `TagAwareAdapterInterface` to `NullAdapter` | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | Fix partly symfony#61114, symfony#59193 | License | MIT The PR makes NullAdapter taggable to easier test same adapters Commits ------- e3eeffc [Cache] Add `TagAwareAdapterInterface` to `NullAdapter`
2 parents e59b73b + e3eeffc commit af32a38

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/Symfony/Component/Cache/Adapter/NullAdapter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* @author Titouan Galopin <[email protected]>
2121
*/
22-
class NullAdapter implements AdapterInterface, CacheInterface, NamespacedPoolInterface
22+
class NullAdapter implements AdapterInterface, CacheInterface, NamespacedPoolInterface, TagAwareAdapterInterface
2323
{
2424
private static \Closure $createCacheItem;
2525

@@ -108,4 +108,9 @@ private function generateItems(array $keys): \Generator
108108
yield $key => $f($key);
109109
}
110110
}
111+
112+
public function invalidateTags(array $tags): bool
113+
{
114+
return true;
115+
}
111116
}

src/Symfony/Component/Cache/Tests/Adapter/NullAdapterTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,11 @@ public function testCommit()
138138
$this->assertTrue($adapter->saveDeferred($item));
139139
$this->assertTrue($this->createCachePool()->commit());
140140
}
141+
142+
public function testInvalidateTags()
143+
{
144+
$adapter = $this->createCachePool();
145+
146+
self::assertTrue($adapter->invalidateTags(['foo']));
147+
}
141148
}

src/Symfony/Component/Config/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.4
5+
---
6+
7+
* Add TagAwareAdapterInterface to NullAdapter
8+
49
7.3
510
---
611

0 commit comments

Comments
 (0)