Skip to content

Commit

Permalink
Fix the issue of using the now function within the ArrayCache in Lume…
Browse files Browse the repository at this point in the history
…n. (#48826)
  • Loading branch information
cxlblm authored Oct 26, 2023
1 parent 98ffb75 commit 56f5c86
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Illuminate/Cache/ArrayStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Cache;

use Illuminate\Contracts\Cache\LockProvider;
use Illuminate\Support\Carbon;
use Illuminate\Support\InteractsWithTime;

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

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

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

return;
Expand Down Expand Up @@ -188,7 +189,7 @@ protected function calculateExpiration($seconds)
*/
protected function toTimestamp($seconds)
{
return $seconds > 0 ? (now()->getPreciseTimestamp(3) / 1000) + $seconds : 0;
return $seconds > 0 ? (Carbon::now()->getPreciseTimestamp(3) / 1000) + $seconds : 0;
}

/**
Expand Down

0 comments on commit 56f5c86

Please sign in to comment.