Redis is Not What You Think It Is.


Redis is Not What You Think It Is.

This issue is brought to you by:

Securing Vibe Coding: Addressing the Security Challenges of AI-Generated Code

As AI coding tools become embedded in daily development,
they bring a new wave of productivity, and new security risks.
On November 20 @ 11AM EST, Snyk Staff Developer Advocate Sonya Moisset
will break down the security implications of vibe coding and share actionable strategies to secure AI-generated code at scale. Attendees can earn 1 CPE credit by registering with your ISC2 member ID and attending this session live!

It's not just a cache.
For years, we've put Redis in a tiny box labeled "fast, in-memory cache".
But I spent over 100 hours watching it in production, and what I saw changed my mind completely.
It’s a beast, and most of us are only using 10% of it.


The Great Database Divide

Here’s a problem we all face: we need our applications to be both fast and reliable.
We need to retrieve data instantly, but we also can't afford to lose it if the server crashes.
It’s a constant war between speed and safety.

Fast vs. Safe: The Old Way

The classic solution is to use two different tools for the job:
We grab Redis for its lightning speed and use it for short-lived information.
This is the Redis we all know.
You set a key with an expiration time:

SET mykey "some temporary data" EX 3

and poof, it's gone when you need it to be - in this instance, 3 seconds later.
Then, for the "important" stuff, we use a traditional database, like a sqlite or postgresql.
The thinking is simple: cache equals fast, database equals safe.
But Redis, can do both!!

Redis: Your Fast AND Safe Database

So, how do I solve it differently.
When I can, I use Redis for both.

Redis is way more than a simple k/v store.
It has built-in data structures like hashes, which are perfect for storing entire objects, just like a document in a nosql database.
You can store a user with their ID, email, name, and login count, all under a single key with

HSET user:1 name "Eve" email "eve@example.com" login_count 1

But what about safety you ask?
What happens if the server restarts?
By default, Redis does occasional snapshots, which aren't reliable enough for critical data.
But there's a feature that changes everything: the Append Only File, or AOF.

By turning on AOF with

CONFIG SET appendonly yes

you tell Redis to log every single write operation to a file.
Every. Single. One.
If the server crashes, Redis simply replays this log to restore its state perfectly.
Suddenly, your in-memory cache is a durable, persistent database.

You can even create your own indexes -
Let’s say you need to find a user by their email.
You can create a key that maps the email address directly to the user's ID, giving you a super-fast lookup with

SET user:email:eve@example.com 1

And what about handling things like unique usernames.
Redis has Sets, which are unordered buckets of unique data.
You can add a username to a set with

SADD usernames "eve"

and Redis will automatically reject any duplicates.

Finally, for the ultimate database feature, what about race conditions?
You can use a transaction:
You tell Redis to watch a key with

WATCH user:1

Then you start a transaction with

MULTI

and queue up your commands, like

HINCRBY user:1 login_count 1

If another client changes that key before you run

EXEC

the entire transaction is aborted.
No more corrupted data.

You get the speed of in-memory with the reliability of a traditional database.
All in one tool you're probably already using.

And this, is how you achieve in memory speed, with DB persistence achieving the fastest database you can think of.

Yes, it comes with a price, but this debate is for another week :)

Thank you for reading.

Feel free to reply directly with any question or feedback.

Have a great weekend!

ESPRESSO FRIDAYS

Every once in a while I send hand picked things I've learned. Kind of like your filter to the tech internet. No spam, I promise!

Read more from ESPRESSO FRIDAYS

Give me 10 minutes and I'll make you a REGEX expert. This issue is brought to you by: Warp is a fully fledged Agentic Development Environment. From prompt → production “The IDE is dead. The ADE is in”.Coding tasks start with a prompt in Warp, not a heavyweight IDE that takes up 3/4 of your screen with code. Warp is free to try but for a limited time, try Warp Pro free for 7 days with 2,500 Al credits-no card required. Click here to start (It’s Free!) Regex has been around for years -...

You’ve been parsing JSON wrong your whole life This issue is brought to you by: Secure Your AI Future at DevSecCon 2025 Software development is undergoing a seismic shift as AI transforms how we build, deploy, and secure applications. Register for the 1st-ever Global Community Summit on AI Security, covering critical strategies to empower AI innovation without compromising security. Register for DevSecCon 2025 (It’s Free!) Ever opened a massive “.log” file and realized it’s just one long,...

Wait… cURL can do WHAT?! Brought to you in collaboration with 1Password and Browserbase: 🔐 Your AI Agents Can Finally Log In! 1Password and Browserbase just partnered to solve AI’s biggest security nightmare: authentication without exposing credentials. Introducing 1Password’s Secure Agentic Autofill, allowing you to connect your 1Password Enterprise Password Manager to your browser automation agent powered by Browserbase. Build AI agents that can actually work without compromising security....