Skip to content

Commit 6587e78

Browse files
committed
add schedule cache method
1 parent 6a70dcf commit 6587e78

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Illuminate/Foundation/Console/Kernel.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,25 @@ public function __construct(Application $app, Dispatcher $events)
9999
protected function defineConsoleSchedule()
100100
{
101101
$this->app->singleton(Schedule::class, function ($app) {
102-
return new Schedule($this->scheduleTimezone());
102+
return (new Schedule($this->scheduleTimezone()))
103+
->useCache($this->scheduleCache());
103104
});
104105

105106
$schedule = $this->app->make(Schedule::class);
106107

107108
$this->schedule($schedule);
108109
}
109110

111+
/**
112+
* Get the name of the cache store that should manage scheduling mutexes.
113+
*
114+
* @return string
115+
*/
116+
protected function scheduleCache()
117+
{
118+
return $_ENV['SCHEDULE_CACHE_DRIVER'] ?? null;
119+
}
120+
110121
/**
111122
* Run the console application.
112123
*

0 commit comments

Comments
 (0)