Skip to content

Commit

Permalink
re #1 fix cache item bug on dateinterval
Browse files Browse the repository at this point in the history
  • Loading branch information
tonydspaniard committed Jun 10, 2019
1 parent 2c2cb59 commit 8023b4c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Altair/Cache/CacheItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public function expiresAfter($time)
if (null === $time) {
$this->expirationTime = $this->defaultLifespan > 0 ? time() + $this->defaultLifespan : null;
} elseif ($time instanceof DateInterval) {
$this->expirationTime = DateTime::createFromFormat('U', time())->add($time)->format('U');
$this->expirationTime = DateTime::createFromFormat('Y-m-d H:i:s', date('Y-m-d H:i:s'))
->add($time)
->format('U');
} elseif (is_int($time)) {
$this->expirationTime = time() + $time;
} else {
Expand Down

0 comments on commit 8023b4c

Please sign in to comment.