PHP code example of mixislv / laravel-model-self-cache
1. Go to this page and download the library: Download mixislv/laravel-model-self-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/ */
mixislv / laravel-model-self-cache example snippets
namespace App;
use mixisLv\SelfCache\Traits\SelfCache;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use SelfCache;
/**
* @see \App\Traits\SelfCache;
* @var string
*/
protected static $selfCacheKeyId = 'id';
/**
* @see \App\Traits\SelfCache;
* @var int
*/
protected static $selfCacheKeyExpiration = 134;
// ...
}
$user = User::getBySelfCacheId($userId);