//Updated Dec 2020
//laravel artisan clear cache
php artisan view:clear
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan optimize:clear
//This clears all laravel caches for views,application, route,configuration
// and complied services and packages
before change:
php artisan cache:clear
php artisan config:clear
php artisan route:clear
after change:
php artisan config:cache
php artisan route:cache
php artisan optimize
//Laravel 7 / 2021-01
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan optimize
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan config:clear
/** Clear all cache Laravel **/
php artisan route:clear && php artisan view:clear && php artisan config:clear && php artisan cache:clear && php artisan clear-compiled
php artisan view:cache
php artisan cache:cache
php artisan route:cache
php artisan config:cache
Cache::put('key', 'value', $seconds);
Cache::rememberForever('users', function () {
return DB::table('users')->get();
});
Cache::get('key');
Cache::has('key');
Cache::pull('key');
// i am using laravel versioin 8 so......
// use this in ur controller then
use IlluminateSupportFacadesCache;
// in function
Cache::put('key', 'value', 1440);// 1 day
Cache::get('key');
Cache::has('key');
Cache::pull('key');
Cache::forget('key');// remove spacific
Cache::flush(); // remove all
use IlluminateSupportFacadesCache;