PHP code example of emprove / laravel-model-caching
1. Go to this page and download the library: Download emprove/laravel-model-caching 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/ */
emprove / laravel-model-caching example snippets
namespace App;
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
abstract class BaseModel
{
use Cachable;
//
}
namespace GeneaLabs\LaravelModelCaching\Tests\Fixtures;
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class BaseModel extends Model
{
use Cachable;
public function __construct($attributes = [])
{
config(['laravel-model-caching.cache-prefix' => 'test-prefix']);
parent::__construct($attributes);
}
}
(new Comment)
->withCacheCooldownSeconds(30)
->get();