Php/laravel/laravel5/htmlcache
Cacheクラスを使ってページキャッシュをする
namespace App\Http\Controllers;
use App\Http\Requests;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
class DebugController extends Controller
{
public function index()
{
$cacheId = md5(__CLASS__);
if (Cache::has($cacheId)) {
return Cache::get($cacheId);
}
$data = ["デバッグ"];
$html = view('debug', $data)->render();
Cache::put($cacheId, $html, 10);
return $html;
}
}