Performance: Storing and retrieving cache
MEDIUM IMPACT
This affects page load speed by reducing database queries and computation time through fast data retrieval from cache.
<?php $data = Cache::remember('users', 3600, fn() => DB::table('users')->get()); // Cache stores result for 60 minutes
<?php
$data = DB::table('users')->get();
// No caching, query runs on every request
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No cache, direct DB query | N/A | N/A | Blocks rendering waiting for server response | [X] Bad |
| Cache with expiration and proper key | N/A | N/A | Fast server response enables quicker paint | [OK] Good |