PHP code example of vinks / laravel-memory-cache
1. Go to this page and download the library: Download vinks/laravel-memory-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/ */
vinks / laravel-memory-cache example snippets
\App\CachedModel::where('id', '<=', 50)->get();
for ($i=0; $i < 200; $i++) {
\App\CachedModel::find(1);
}
// Only one request will be made :
// SELECT * FROM `cached_models` WHERE `id` <= 50
class VeryOftenLoadItem extends Model
{
use \Vinks\MemoryCaching\SimpleMemoryCached;
// Additionnally, you can change the maximum number of items will be kept for a model. Default: 50.
const MEMORY_CACHE_LIMIT = 50;
}