Skip to content

Commit

Permalink
Improved tests for issue #893
Browse files Browse the repository at this point in the history
  • Loading branch information
Geolim4 committed Feb 18, 2023
1 parent 05bd124 commit 8614c56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/Phpfastcache/Core/Pool/TaggableCacheItemPoolTrait.php
Expand Up @@ -410,10 +410,6 @@ protected function driverWriteTags(ExtendedCacheItemInterface $item): bool
$data = \array_merge((array)$data, [$item->getKey() => $expTimestamp]);
$tagsItem->set($data);

if (!$tagsItem->isHit() || $tagsItem->getExpirationDate() < $item->getExpirationDate()) {
$tagsItem->expiresAt($item->getExpirationDate());
}

/**
* Recalculate the expiration date
*
Expand Down
7 changes: 7 additions & 0 deletions tests/issues/Github-893.test.php
Expand Up @@ -35,6 +35,13 @@
$cacheInstance->save($CachedString2);
}

$CachedString3 = $cacheInstance->getItem("key_3");
if (is_null($CachedString3->get())) {
$CachedString3->set("data3")->expiresAfter(4);
$CachedString3->addTag("query");
$cacheInstance->save($CachedString3);
}

$cacheInstance->detachAllItems();
$testHelper->printInfoText('Items created and saved, sleeping 6 secondes to force "key_1" to expire');
sleep(6);
Expand Down

0 comments on commit 8614c56

Please sign in to comment.