Home > Software engineering >  Continuous cleaning of Laravel cache especially for the package spatie/laravel-permission
Continuous cleaning of Laravel cache especially for the package spatie/laravel-permission

Time:12-26

I have a problem with Laravel cache, When I add/change the route or change the roles in the spatie/laravel-permission package, I must clear the cache, Is there a solution to this issue?

CodePudding user response:

By default, it is set to 24 hours.

You can change it in the config/permissions.php file.

The default cache expiration_time is 24 hours. If you wish to alter the expiration time you may do so in the config/permission.php file, in the cache array.

https://spatie.be/docs/laravel-permission/v5/advanced-usage/cache

CodePudding user response:

You can run these cache removing commands from your controller.

Artisan::call("cache:forget spatie.permission.cache"); 
Artisan::call("cache:clear");
  • Related