Skip to content

Commit 56f5c86

Browse files
authored
Fix the issue of using the now function within the ArrayCache in Lumen. (#48826)
1 parent 98ffb75 commit 56f5c86

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Illuminate/Cache/ArrayStore.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Illuminate\Cache;
44

55
use Illuminate\Contracts\Cache\LockProvider;
6+
use Illuminate\Support\Carbon;
67
use Illuminate\Support\InteractsWithTime;
78

89
class ArrayStore extends TaggableStore implements LockProvider
@@ -57,7 +58,7 @@ public function get($key)
5758

5859
$expiresAt = $item['expiresAt'] ?? 0;
5960

60-
if ($expiresAt !== 0 && (now()->getPreciseTimestamp(3) / 1000) >= $expiresAt) {
61+
if ($expiresAt !== 0 && (Carbon::now()->getPreciseTimestamp(3) / 1000) >= $expiresAt) {
6162
$this->forget($key);
6263

6364
return;
@@ -188,7 +189,7 @@ protected function calculateExpiration($seconds)
188189
*/
189190
protected function toTimestamp($seconds)
190191
{
191-
return $seconds > 0 ? (now()->getPreciseTimestamp(3) / 1000) + $seconds : 0;
192+
return $seconds > 0 ? (Carbon::now()->getPreciseTimestamp(3) / 1000) + $seconds : 0;
192193
}
193194

194195
/**

0 commit comments

Comments
 (0)