Skip to content

Commit 8e4cd48

Browse files
committed
Saving an expired value should be the same as removing that value (#49)
* Saving an expired value should be the same as removing that value * Updated tests version
1 parent 6486cbd commit 8e4cd48

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

AbstractCachePool.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ public function save(CacheItemInterface $item)
180180
if ($item instanceof HasExpirationDateInterface) {
181181
if (null !== $expirationDate = $item->getExpirationDate()) {
182182
$timeToLive = $expirationDate->getTimestamp() - time();
183+
184+
if ($timeToLive < 0) {
185+
return $this->deleteItem($item->getKey());
186+
}
183187
}
184188
}
185189

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"require-dev": {
3131
"phpunit/phpunit": "^4.0|^5.1",
32-
"cache/integration-tests": "^0.9"
32+
"cache/integration-tests": "^0.10"
3333
},
3434
"autoload": {
3535
"psr-4": {

0 commit comments

Comments
 (0)