Caching Isn’t a SaaS Product, It’s a Data Structure

The industry won’t tell you this, but a hashmap does 90% of what you need

Scan texture
Scan texture

Published On

Mon Feb 17 2025

0
/
0

The other day, I witnessed something painful that happens way too often: I watched a developer struggle through a problem that would have been a slam dunk for a hashmap. Instead of using the right tool they went full exponential mode, looping through an ordered array like leetcode never existed. And when I brought up caching the result? They talked about it like it’s something you integrate from a vendor, not just a hashmap in their service’s search method.

Why is it that developers think a cache has to be a vendor product? Why is “we need caching” immediately followed by “let’s pay AWS money” instead of “let’s use a hashmap and move on with our lives”? You don’t need some heavyweight distributed cache just to handle burstiness, deduplicate events, or enforce uniqueness. You just need to understand your data structures.

An LRU is the FIFO of caches and it needs a hashmap (or a Dict for the Python people reading).

The “Cache as a Service” Fallacy

Caching isn’t a SaaS product, it’s a pattern. If you need a globally distributed, highly available cache, sure — buy something off the shelf. But if you’re just trying to optimize inside a single service, why are you reaching for Redis? Why not just… use a hashmap?

Need to control burstiness? Hashmap. Need quick lookups? Hashmap. Need to deduplicate requests? Hashmap.

Half the time, you don’t need a distributed cache, you need basic computer science knowledge.

LLMs Are Making This Worse

Now, with AI-assisted coding, I’m seeing this mindset even more. Developers are generating code fast, but they’re skipping the part where they actually understand it. LLMs don’t care about the best solution, they care about the most generic solution. And guess what’s generic? “Oh, you need a cache? Let’s add Redis.” Meanwhile, the correct answer was just a hashmap the whole time.

If you can’t recognize when to use a hashmap instead of a cache product, you’re not “saving time” — you’re making your system unnecessarily complex. And for what? So you can say you’re “leveraging managed services” while your simple API call now has an external dependency for no reason?

If you’re going to reach for a SaaS in an interview, you’d better be able to explain exactly where it fits in your architecture and why it’s necessary — otherwise, you’re just cargo-culting it.

Interviewing? Make Sure You Understand Caching

If you’re in a coding interview, at least know what you’re doing when it comes to caching. Even if you give a naive solution, you should be able to follow up with, “Here’s why a hashmap would be a better fit.” Show that you understand the trade-offs.

This isn’t about trick questions — it’s about understanding that sometimes the best solution is the simplest one. If you reach for Redis when a hashmap would do you’re not “scaling your system,” you’re overcomplicating it.

Wrapping Up — Build Skillful Software

Before you slap a cache product into your stack, ask yourself: Do I really need this? Will a hashmap or an in-memory structure solve the problem just as well? More often than not, yes, it will.

Stop treating caching like a SaaS product and start treating it like a problem you actually have to think about. Writing good software isn’t about adding more tools — it’s about knowing when you don’t need them.

Blog Posts

I share insights from my journey in software development, user experience, and entrepreneurship, with a focus on building scalable systems, tackling complex challenges, and driving innovation.

Caching Isn’t a SaaS Product, It’s a Data Structure

The industry won’t tell you this, but a hashmap does 90% of what you need

The Ultimate Tool for Managing Types in Monorepos

gRPC Is the Secret Weapon Your Monorepo Desperately Needs

Divide and Conquer Timeline Data with Typescript

Typescript time series and Date objects

The Growing Importance of SMEs in AI Agent Design

AI agents are revolutionizing industries, but here's why they still need us more than ever

The Myth of the “Universal Language” for Internal Tool Development

We've all heard this story before. You finally get buy-in to build a tool that solves your pet peeve. You have a plan figured out, but then your manager says the dreaded phrase, “Use a different language so that others can contribute”… which seldom happens.

The Performant Interface Dilemma: Taming Object Equality in React

A comprehensive guide for developers on handling object equality issues in JavaScript, with a focus on practical solutions for React applications

Will My Startup's Problem Be Big Enough?

How to evaluate the potential of a startup idea by understanding your Serviceable Obtainable Market, the Venn diagram of opportunity

UX Meets Database Design, a Match Made in Heaven

Putting UX at the heart of user-centric SQL schema data modeling

I Stuffed TensorFlow.js Into a React App

Here's what I learned about Web Workers

Social Distanced UX Research Strategies For your Next iOS App

COIVD forced us to stop using in-person UX research. Here are some tried and true methods we're keeping after the lockdowns lift

How to Deploy Flutter for Web Apps with Netlify

Have you ever wanted to turn your iPad or iPhone app into a website?