Skip to content

Commit 82eacea

Browse files
committed
Allow for TTL being NULL
1 parent a156a53 commit 82eacea

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/FilesystemCachePool.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function fetchObjectFromCache($key)
4545
}
4646

4747
$data = unserialize($this->filesystem->read($file));
48-
if (time() > $data[0]) {
48+
if ($data[0] !== null && time() > $data[0]) {
4949
return [false, null];
5050
}
5151

@@ -76,7 +76,10 @@ protected function storeItemInCache($key, CacheItemInterface $item, $ttl)
7676
$this->filesystem->delete($file);
7777
}
7878

79-
return $this->filesystem->write($file, serialize([time() + $ttl, $item->get()]));
79+
return $this->filesystem->write($file, serialize([
80+
($ttl === null ? null : time() + $ttl),
81+
$item->get(),
82+
]));
8083
}
8184

8285
/**

0 commit comments

Comments
 (0)