Skip to content

November 2026 · Redis · Caching · Laravel

Where Redis Actually Helps

Redis is excellent, and easy to reach for too early. These are the three jobs I use it for, and what I check first.

Where Redis Actually Helps

Check the query first

When a page is slow, adding a cache feels like progress. Often it just hides the real problem, and now you have two problems: a slow query and stale data. So I look at the query first. A missing index, or a loop running one query per row, explains most of the slow pages I have ever opened. Fixing that is permanent, and it costs nothing to run.

Job one: data that is read constantly

Some data is read on nearly every request and changes rarely, like settings. In my school system, mail and storage settings are cached for an hour with Laravel’s Cache::remember, and the model clears that key whenever someone saves a change. That second half is the important part. A cache without a clear rule for when it empties is just a bug scheduled for later.

Job two: counting things quickly

Rate limiting needs a counter that is fast and expires by itself, and that is what Redis does naturally. To protect an OTP endpoint, you increment a key for that phone number and let it expire after a few minutes. There is no table to clean up, and it holds up under load. This is the use case where Redis is hardest to replace.

Job three: queues under real volume

Laravel can move jobs from the database to Redis with a config change. It handles far more throughput and keeps the main database free of queue traffic. The catch is that Redis often lives in memory, so you need to understand how it persists data. If losing queued jobs in a restart would hurt, that has to be planned for.

Keys and tenants

In a multi-tenant product, cache keys deserve real care. A key called settings is an accident waiting to happen, because one school could see another school’s data. Every key should include the tenant, such as tenant:42:settings, and every key should have an expiry. I would treat a wrong cache key the same way as a wrong database query, because to the customer it is the same leak.

Md. Fawjul Azim

Focusing on building high-performance web applications with modern tech stacks.