Skip to content

Commit

Permalink
Lumen does not have the now() helper. (laravel#47017)
Browse files Browse the repository at this point in the history
Fixes 'Call to undefined function Illuminate\Cache\now()'.

Co-authored-by: Slavey Karadzhov <[email protected]>
  • Loading branch information
2 people authored and milwad-dev committed May 12, 2023
1 parent 5b33ce4 commit 5209033
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Illuminate/Cache/RedisTagSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Cache;

use Illuminate\Support\LazyCollection;
use Illuminate\Support\Carbon;

class RedisTagSet extends TagSet
{
Expand All @@ -16,7 +17,7 @@ class RedisTagSet extends TagSet
*/
public function addEntry(string $key, int $ttl = 0, $updateWhen = null)
{
$ttl = $ttl > 0 ? now()->addSeconds($ttl)->getTimestamp() : -1;
$ttl = $ttl > 0 ? Carbon::now()->addSeconds($ttl)->getTimestamp() : -1;

foreach ($this->tagIds() as $tagKey) {
if ($updateWhen) {
Expand Down Expand Up @@ -72,7 +73,7 @@ public function flushStaleEntries()
{
$this->store->connection()->pipeline(function ($pipe) {
foreach ($this->tagIds() as $tagKey) {
$pipe->zremrangebyscore($this->store->getPrefix().$tagKey, 0, now()->getTimestamp());
$pipe->zremrangebyscore($this->store->getPrefix().$tagKey, 0, Carbon::now()->getTimestamp());
}
});
}
Expand Down

0 comments on commit 5209033

Please sign in to comment.