Skip to content

Commit

Permalink
Fixed #893 // getItemsByTag() - empty after one item has expired
Browse files Browse the repository at this point in the history
  • Loading branch information
Geolim4 committed Feb 11, 2023
1 parent 5bd58cb commit ad4ac95
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 8.1.4
#### _"Masks fell, for good.."_
##### 12 february 2023
- __Core__
- Fixed #893 // getItemsByTag() - empty after one item has expired

## 8.1.3
#### _"Don't throw the masks, yet."_
##### 25 may 2022
Expand Down
13 changes: 11 additions & 2 deletions lib/Phpfastcache/Core/Pool/TaggableCacheItemPoolTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,17 @@ protected function driverWriteTags(ExtendedCacheItemInterface $item): bool
* that has slow performances
*/

$tagsItem->set(\array_merge((array)$data, [$item->getKey() => $expTimestamp]))
->expiresAt($item->getExpirationDate());
$data = \array_merge((array)$data, [$item->getKey() => $expTimestamp]);
$tagsItem->set($data);

/**
* Recalculate the expiration date
*
* If the $tagsItem does not have
* any cache item references left
* then remove it from tagsItems index
*/
$tagsItem->expiresAt((new DateTime())->setTimestamp(max($data)));

$this->driverWrite($tagsItem);
$tagsItem->setHit(true);
Expand Down

0 comments on commit ad4ac95

Please sign in to comment.