August 17, 2026โ€ข4 min read

Getting to Know Redis: More Than Just an In-Memory Cache

Still treating Redis as nothing but a cache? It can be a leaderboard, a message broker, even a rate limiter. Let's take apart everything it can do.

Read in Indonesian

If you often talk about backend performance tuning or speeding up database queries, the name Redis almost always sneaks into the conversation.

Most of us know Redis as a temporary cache. But did you know Redis is far more flexible than ordinary caching? ๐Ÿค”

Short for Remote Dictionary Server, Redis is an open-source, in-memory data store that can act as a database, a cache, a message broker, even a streaming engine. Let's take apart why Redis became a required component in almost every modern application architecture.

Key takeaways

  • Redis runs every operation directly in RAM, so read and write latency can sit in the sub-millisecond range.
  • Its data structures are rich, from Strings, Hashes, Lists, Sets, and Sorted Sets through to Streams.
  • Redis works flexibly for caching, session management, rate limiting, and leaderboards.
  • A client library like redis-py makes integration into a Python application feel instant.

Why Does RAM Make Redis So Fast?

Relational databases like PostgreSQL or MySQL store their data on disk (SSD/HDD). Even though modern SSDs are fast, reading data from disk still takes time, because there is a physical I/O process involved.

Unlike conventional databases, Redis keeps its entire dataset inside RAM (Random Access Memory).

Here is the simple picture. A database on disk is like walking to the shed out back to fetch a notebook. Redis in RAM is more like leaving that notebook right on your desk, so you glance over and grab it without losing any time.

Because every operation happens in RAM, Redis read and write latency can sit at the sub-millisecond level, in other words under 1 millisecond. Very fast, right? ๐Ÿ˜„

A Full Set of Data Structures

Even though it is key-value based, a value in Redis is not limited to plain text. Redis supports many rich data structures you can manipulate directly at the server level:

  1. Strings: plain text or numbers, good for storing tokens or HTML caches.
  2. Hashes: field-value pairs that resemble a JSON object, suited to a user profile.
  3. Lists: an ordered collection of strings in insertion order, good for a queue or a timeline feed.
  4. Sets: a collection of unique values with no duplicates.
  5. Sorted Sets (ZSet): a set where each element carries a score for ordering, perfect for a leaderboard in a game.
  6. Pub/Sub and Streams: features for sending messages in real-time.

The Main Uses of Redis in the Real World

Here are a few scenarios where Redis shows up most often:

  • Query caching: store the result of a heavy query so the next request never touches the primary database.
  • Session management: store user login session data, such as a JWT or Session ID, so many backend instances can read it fast.
  • Rate limiting: cap how many API requests one user may send in a given period, for example 100 requests per minute.
  • Leaderboards and counting: tally game scores or viewer counts in real-time.

An Example of Redis With Python

Here is a simple example using the redis-py library in Python to store and retrieve cache data:

PYTHON
import redis

 # Connect to the local Redis server
r = redis.Redis(host='localhost', port=6379, db=0)

 # Store cache data with a 60-second expiry (TTL)
r.set('user:101:profile', '{"name": "Daffa", "role": "Engineer"}', ex=60)

 # Read the data from the cache
cached_profile = r.get('user:101:profile')
if cached_profile:
    print("Data ditemukan di Redis:", cached_profile.decode('utf-8'))
else:
    print("Cache miss! Ambil dari database utama...")

With just those few lines, your application already has an extremely fast caching layer. It takes under a minute to add.

Get the Most Out of Redis in Your System

Limiting Redis to ordinary caching is like buying a sports car and driving it only to the corner shop. Its range of data structures, from Hashes and Sorted Sets to Streams, opens up wide performance opportunities across many modern application scenarios.

Look again at the system architecture you are building. Which feature could you boost with the lightning memory speed Redis offers?

Happy Redising, and may your system bottlenecks always lose the race against server RAM. ๐Ÿ‘‹

Get better at shipping code.

Join the other developers getting tech updates, tips, and relaxed tutorials in their inbox every week.

Stay in the loop

Tech updates, coding tips, and relaxed insights straight to your inbox every week.

No spam. Unsubscribe anytime.

Read next

See all

For developers who learn by struggling

ยฉ 2026 Inva.dev.