Change cache driver for Laravel Task Scheduler onOneServer

With onOneServer you can prevent jobs from running on multiple workers:

$schedule->command('report:generate')
    ->fridays()
    ->at('17:00')
    ->onOneServer();

It uses the default cache driver configured by the environment variable CACHE_DRIVER. But what if you want to use another one?

That’s possible by calling useCache with the desired cache driver name:

$schedule->command('report:generate')
    ->fridays()
    ->at('17:00')
    ->useCache('database')
    ->onOneServer();

We welcome your feedback

We enjoy compliments, but you can totally shout at us for doing it wrong on our Twitter account 👋