Skip to content

Commit a1ec191

Browse files
Lumen does not have the now() helper. (#47017)
Fixes 'Call to undefined function Illuminate\Cache\now()'. Co-authored-by: Slavey Karadzhov <[email protected]>
1 parent d925372 commit a1ec191

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Illuminate/Cache/RedisTagSet.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\Support\LazyCollection;
6+
use Illuminate\Support\Carbon;
67

78
class RedisTagSet extends TagSet
89
{
@@ -16,7 +17,7 @@ class RedisTagSet extends TagSet
1617
*/
1718
public function addEntry(string $key, int $ttl = 0, $updateWhen = null)
1819
{
19-
$ttl = $ttl > 0 ? now()->addSeconds($ttl)->getTimestamp() : -1;
20+
$ttl = $ttl > 0 ? Carbon::now()->addSeconds($ttl)->getTimestamp() : -1;
2021

2122
foreach ($this->tagIds() as $tagKey) {
2223
if ($updateWhen) {
@@ -72,7 +73,7 @@ public function flushStaleEntries()
7273
{
7374
$this->store->connection()->pipeline(function ($pipe) {
7475
foreach ($this->tagIds() as $tagKey) {
75-
$pipe->zremrangebyscore($this->store->getPrefix().$tagKey, 0, now()->getTimestamp());
76+
$pipe->zremrangebyscore($this->store->getPrefix().$tagKey, 0, Carbon::now()->getTimestamp());
7677
}
7778
});
7879
}

0 commit comments

Comments
 (0)