Skip to content

Commit 44fe516

Browse files
authored
Merge pull request #772 from GeoSot/fix-inconsistency-on-strategy-usage
DeleteItemsByTags was ignoring strategy
2 parents 97fa806 + 02cdc8c commit 44fe516

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ PhpFastCache provides you a lot of useful APIs:
109109
| `deleteItem($key)` | bool | Deletes an item |
110110
| `deleteItems(array $keys)` | bool | Deletes one or more items |
111111
| `deleteItemsByTag($tagName)` | bool | Deletes items by a tag |
112-
| `deleteItemsByTags(array $tagNames)` | bool | Deletes items by one of multiple tag names |
112+
| `deleteItemsByTags(array $tagNames, int $strategy)` | bool | Deletes items by one of multiple tag names |
113113
| `detachItem($item)` | void | Detaches an item from the pool |
114114
| `getConfig()` | ConfigurationOption | Returns the configuration object |
115115
| `getConfigOption($optionName);` | mixed | Returns a configuration value by its key `$optionName` |

lib/Phpfastcache/Core/Pool/TaggableCacheItemPoolTrait.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ protected function getTagKey(string $key): string
127127
public function deleteItemsByTags(array $tagNames, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool
128128
{
129129
$return = null;
130-
foreach ($tagNames as $tagName) {
131-
$result = $this->deleteItemsByTag($tagName, $strategy);
130+
131+
foreach ($this->getItemsByTags($tagNames, $strategy) as $item) {
132+
$result = $this->deleteItem($item->getKey());
132133
if ($return !== false) {
133134
$return = $result;
134135
}

0 commit comments

Comments
 (0)