There's a moment every SaaS developer dreads. Your app is ticking along nicely, you're onboarding new customers, and then - almost without warning - things start to slow down. Pages that loaded in 200ms are now creeping past a second. Your database server is sweating. Users are noticing.
I've been there more than once in 25 years of building web applications, and almost every time the root cause has been the same: caching was either an afterthought or implemented in a way that didn't scale.
So let me walk you through the caching strategy I now reach for on every Laravel SaaS I build. It's not revolutionary, but it's deliberate - and deliberate beats clever every time.
Start With What You're Actually Solving
Before you cache anything, ask yourself what problem you're trying to solve. That sounds obvious, but I've watched developers (including past-me) reflexively throw caching at every query without understanding the access patterns.
Generally, caching makes sense when:
- A piece of data is expensive to compute or retrieve
- That data is read far more often than it changes
- Slightly stale data is acceptable for that context
That third point matters more than people admit. Not everything can or should be cached. Billing information, live inventory counts, anything with strict consistency requirements - these need to hit the database. Everything else is a conversation.
Laravel's Cache Facade Is Your Friend - Use It Wisely
Laravel ships with a genuinely excellent caching abstraction. I use Redis in production for every project I build these days, but the beauty of the Cache facade is that the code looks the same regardless of your driver.
My go-to pattern is remember:
$plans = Cache::remember('subscription_plans', now()->addHours(6), function () {
return Plan::active()->with('features')->get();
});
Clean, readable, and it handles the check-and-store logic for you. The key thing I've learned is to be intentional about TTLs. Six hours makes sense for subscription plans that rarely change. It makes no sense for a user's notification count.
Tag Your Cache Keys Like Your Future Self Depends On It
Once you have more than a handful of cache entries, invalidation becomes the real challenge. Laravel's cache tagging (available with Redis and Memcached) is a lifesaver here.
Cache::tags(['tenant:' . $tenantId, 'reports'])->remember(
'monthly_revenue',
now()->addMinutes(30),
fn () => $this->revenueService->monthly()
);
Now when something changes that affects a tenant's reports, I can flush just that tag:
Cache::tags(['tenant:' . $tenantId, 'reports'])->flush();
No more nuking your entire cache because you updated one record. In a multi-tenant SaaS, this is essential. You don't want one tenant's data change wiping cached data for everyone else.
Model-Level Caching With Care
I do sometimes cache individual Eloquent model results, but I've learned to be careful. The pattern I like is to wrap it in a dedicated method on the model or a repository class, rather than scattering Cache::remember calls throughout controllers.
public static function findCached(int $id): static
{
return Cache::tags(['users'])->remember(
"user:{$id}",
now()->addMinutes(15),
fn () => static::findOrFail($id)
);
}
This keeps the caching logic in one place and makes it easy to reason about. If you ever need to change the TTL or the cache key format, you change it once.
Don't Forget the HTTP Layer
Application-level caching is only part of the picture. I also think hard about HTTP caching, especially for Livewire-heavy interfaces where full page loads still happen.
For public-facing pages - marketing pages, blog posts, pricing - I'll use a combination of Cache-Control headers and sometimes a CDN in front of the app. Laravel makes it straightforward to set response headers:
return response()
->view('marketing.pricing')
->header('Cache-Control', 'public, max-age=3600');
For authenticated SaaS dashboards, this gets more nuanced. I tend to lean on Livewire's own reactivity here rather than HTTP caching, keeping component data fresh without hammering the database on every interaction.
Livewire and Caching: A Quick Word
Since most of my apps use Livewire v3, I want to mention one pattern I find really useful. If a Livewire component loads expensive data on mount that doesn't need to be live, I'll cache it at the component level:
public function mount(): void
{
$this->stats = Cache::remember(
'dashboard_stats_' . auth()->id(),
now()->addMinutes(5),
fn () => $this->statsService->forUser(auth()->user())
);
}
Five minutes might feel short, but for a dashboard summary it means users get snappy load times without seeing data that's too far out of date. Adjust to taste based on how real-time your users expect things to be.
Cache Warming: Don't Just Hope
One thing I've started doing on larger projects is proactive cache warming. Rather than waiting for the first user to hit a slow query and trigger the cache population, I'll warm critical cache keys as part of a scheduled job:
// In a scheduled command
public function handle(): void
{
Cache::forget('global_stats');
Cache::remember('global_stats', now()->addHour(), fn () => (
$this->statsService->global()
));
}
This means the first user of the day isn't the one bearing the cost of rebuilding a cold cache.
Monitoring Matters
All of this is only as good as your visibility into what's happening. I use Laravel Telescope in development to watch cache hits and misses in real time. In production, I lean on Laravel Pulse for an overview of what's slow and where cache pressure is building up.
If you're not watching your cache hit rate, you're flying blind. A cache that's being invalidated too aggressively might as well not exist.
The Honest Summary
Good caching isn't about being clever - it's about being consistent. Know what you're caching and why, tag your keys so invalidation stays sane, and monitor what's actually happening in production.
Do those three things and you'll be surprised how much headroom your app has, even as your user count grows. The SaaS apps I've built with this approach in place from the start have consistently handled growth without the panicked 2am database optimisation sessions I used to dread.
If you're building a SaaS on Laravel and want to talk through your caching strategy, feel free to reach out - I'm always happy to have that conversation.