mercredi 3 février 2016

Caching Vs. Query Directly from Database in Laravel

Query Directly from Database

Route::get('/users', function() {
    $user = User::all();
    return $users; 
});


Caching

Route::get('/users', function() {
    $users = User::all();
    Cache::put('users',$user,60);
    if(Cache::has('users')){
        return Cache::get('users');
    }
});


Result

Comparing both of these in the browser when page load, I don't notice the different at all.

they both returned list of users of my database

Is there any tool/way to show the performance of them ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire