diff --git a/AbstractCachePool.php b/AbstractCachePool.php index c2c368a..3eebf81 100644 --- a/AbstractCachePool.php +++ b/AbstractCachePool.php @@ -180,6 +180,10 @@ public function save(CacheItemInterface $item) if ($item instanceof HasExpirationDateInterface) { if (null !== $expirationDate = $item->getExpirationDate()) { $timeToLive = $expirationDate->getTimestamp() - time(); + + if ($timeToLive < 0) { + return $this->deleteItem($item->getKey()); + } } } diff --git a/composer.json b/composer.json index 5cb5305..71ba31b 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ }, "require-dev": { "phpunit/phpunit": "^4.0|^5.1", - "cache/integration-tests": "^0.9" + "cache/integration-tests": "^0.10" }, "autoload": { "psr-4": {