Ilya Nikitin
Ilya Nikitin

Reputation: 33

Calling a method after laravel cache storage expires

I want to set cache storage, for example for 10 minutes

and after 10 minutes so that the cache is not only cleared, but also calls the method

is it possible to do this with laravel cache?

thx for answers

Upvotes: 0

Views: 93

Answers (1)

You can prepare a url like this.

Route::get('/clear-cache', function() {
    $exitCode = Artisan::call('cache:clear');
    return "Cache is cleared";
});

You can then run a cron job like this.

*/5 * * * * wget https://example.com/clear-cache

You can get more information by clicking the link.

Upvotes: 0

Related Questions