Skip to content

Commit 8614c56

Browse files
committed
Improved tests for issue #893
1 parent 05bd124 commit 8614c56

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/Phpfastcache/Core/Pool/TaggableCacheItemPoolTrait.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,6 @@ protected function driverWriteTags(ExtendedCacheItemInterface $item): bool
410410
$data = \array_merge((array)$data, [$item->getKey() => $expTimestamp]);
411411
$tagsItem->set($data);
412412

413-
if (!$tagsItem->isHit() || $tagsItem->getExpirationDate() < $item->getExpirationDate()) {
414-
$tagsItem->expiresAt($item->getExpirationDate());
415-
}
416-
417413
/**
418414
* Recalculate the expiration date
419415
*

tests/issues/Github-893.test.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
$cacheInstance->save($CachedString2);
3636
}
3737

38+
$CachedString3 = $cacheInstance->getItem("key_3");
39+
if (is_null($CachedString3->get())) {
40+
$CachedString3->set("data3")->expiresAfter(4);
41+
$CachedString3->addTag("query");
42+
$cacheInstance->save($CachedString3);
43+
}
44+
3845
$cacheInstance->detachAllItems();
3946
$testHelper->printInfoText('Items created and saved, sleeping 6 secondes to force "key_1" to expire');
4047
sleep(6);

0 commit comments

Comments
 (0)