PHP code example of laravel-enso / rememberable

1. Go to this page and download the library: Download laravel-enso/rememberable 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/ */

    

laravel-enso / rememberable example snippets


return [
    'cacheLifetime' => (int) env('CACHE_LIFETIME', 3600),
    'keys' => ['id'],
];

use Illuminate\Database\Eloquent\Model;
use LaravelEnso\Rememberable\Traits\Rememberable;

class Company extends Model
{
    use Rememberable;

    protected $rememberableKeys = ['id', 'name', 'fiscal_code'];
}

$company = Company::cacheGet(1);

$company = Company::cacheGetBy('name', 'Earthlink');

class Product extends Model
{
    use Rememberable;

    protected $cacheLifetime = 100;
}

class Setting extends Model
{
    use Rememberable;

    protected $cacheLifetime = 'forever';
}
bash
php artisan vendor:publish --tag=rememberable-config