Skip to content

Commit

Permalink
Saving an expired value should be the same as removing that value (#49)
Browse files Browse the repository at this point in the history
* Saving an expired value should be the same as removing that value

* Updated tests version
  • Loading branch information
Nyholm committed Apr 24, 2016
1 parent 6486cbd commit 8e4cd48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions AbstractCachePool.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 8e4cd48

Please sign in to comment.