PHP code example of neurony / laravel-query-cache

1. Go to this page and download the library: Download neurony/laravel-query-cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

neurony / laravel-query-cache example snippets




namespace App;

use Illuminate\Database\Eloquent\Model;
use Neurony\QueryCache\Traits\IsCacheable;

class YourModel extends Model
{
    use IsCacheable;
}

app('cache.query');

// or

app(QueryCacheServiceContract::class);

// from her on, no queries will be cached
app('cache.query')->disableQueryCache();

/*
make your queries
the queries up until now won't be cached
*/

// from her on, apply query caching
app('cache.query')->enableQueryCache();

/*
make your queries
this queries will be cached
*/

php artisan vendor:publish --provider="Neurony\QueryCache\ServiceProvider" --tag="config"