Answers for "how to cache queries in laravel"

PHP
0

cache clear in laravel

php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan clear-compiled
php artisan config:cache
Posted by: Guest on December-20-2020
0

laravel cache

Cache::put('key', 'value', $seconds);
Cache::rememberForever('users', function () {
    return DB::table('users')->get();
}); 
Cache::get('key');
Cache::has('key');
Cache::pull('key');
Posted by: Guest on November-24-2020
0

laravel cache

// i am using laravel versioin 8  so...... 
// use this in ur controller then
use Illuminate\Support\Facades\Cache;
// 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
Posted by: Guest on April-14-2022

Browse Popular Code Answers by Language