Caching
Caching reuses derived data for a bounded time.
What it is
Caching reuses derived data for a bounded time.
When to use it
Use for expensive repeat reads, not as the sole source of balances.
Syntax
Cache::remember("currencies", 60, fn () => Currency::all());Example
use Illuminate\Support\Facades\Cache;
$summary = Cache::remember("user:{$user->id}:summary", 30,
fn () => $user->orders()->where("status", "paid")->sum("total_cents")
);Common mistakes
Include actor/tenant scope in keys; plan invalidation; stale data can mislead financial decisions.