/** Clear all cache Laravel **/
php artisan route:clear && php artisan view:clear && php artisan config:clear && php artisan cache:clear && php artisan clear-compiled
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
1 _ go to app/console/Kernel.php
2 _ do everything that you want in schedule like this :
protected function schedule(Schedule $schedule)
{
$schedule->call(function () {
DB::table('recent_users')->delete();
})->daily();
}
use IlluminateSupportFacadesCache;