Sitemap
Aaranya

Aaranya

Beyond the code, i am passionate about technical writing and simplifying the magic behind frameworks for other developers.

Redis(REmote DIctionary Server)

3 min readJul 2, 2026

--

It is an open-source, in-memory data structure store ie)It keeps all its data in the server’s main memory (RAM) rather than on a slow hard drive.

The Big Question: What happens if the server crashes?

If RAM clears when the power goes out, how can anyone trust Redis with data?

Even though Redis is an in-memory database, it has persistence mechanisms to protect your data. It writes its changes to a background disk file using two main methods:

  1. RDB (Redis Database Snapshots): Every few minutes, Redis takes a quick “snapshot” of what is in the RAM and saves it to a file. If it crashes, it loads the last snapshot.
  2. AOF (Append Only File): Every time a write command happens, Redis logs that command to a file on the disk. If the server restarts, it replays those commands to rebuild the memory state.

The Key Takeaway: Redis does all of its reading and writing directly in RAM to give you maximum speed, but it copies that data to a disk quietly in the background just in case something goes wrong.

A Quick Cheat-Sheet

  1. Install Redis server

Redis is fundamentally built for Unix-like environments, there isn’t an official .exe installer from the main Redis project. However, getting redis-cli up and running on Windows 11 is

Install WSL
Open PowerShell
Run the following command:


wsl — install

Open your Ubuntu terminal:

  

curl -fsSL https://packages.redis.io/gpg | sudo gpg — dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo “deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main” | sudo tee /etc/apt/sources.list.d/redis.list

sudo apt-get update
sudo apt-get install redis -y
sudo service redis-server start
redis-cli

2. Verify Installation

To check if Redis is installed correctly, open your Command Prompt (cmd) and run: redis-server

3. Starting & Stopping the Server

To start the client: Run (redis-cli) in your terminal.

To stop the server:

Get Aaranya’s stories in your inbox

Join Medium for free to get updates from this writer.

While in the redis-cli, type (shutdown)

Using Windows Services (Recommended for background running):

If you installed Redis as a service, you can manage it without keeping a terminal open:

  1. Press Win + R, type services.msc, and hit Enter.
  2. Search for Redis.
  3. Right-click to Start, Stop, or Restart the service.

. Once you have entered the CLI (redis-cli), you can use these commands:

  • Check Server Info: info
  • Test Connection: ping (If connected, it will return PONG)
  • Quit Connection: quit

Key -Value Pair:

. Redis stores data in a simple key-value format.

To Set Key:

# Syntax
set key value

# Example
set name "Malar"

To Get Key:

#Syntax 
get key

#Example
get name

To Delete Key:

#Syntax
del key

#Example
del name

To Delete multiple key:

#Syntax 
del k1 k2 k3

#example
del name age education

Redis is single-threaded, Here, del will delete key synchronously example it will delete k1 first, then k2 and then k3, if k2 has large amount of data it will wait for it to delete continuously and then delete k3, so it is blocking in nature. Inorder to avoid it we can go for UNLINK

Unlink:


#Syntax
unlink k1 k2 k3

#example
unlink name age education

Here it will immediately removes the keys from the database index (making them instantly invisible to clients), and then hands the actual memory cleanup over to a background thread.

Check existence:

#Syntax
exists key

#Example:
exists name

--

--

Aaranya

Written by Aaranya

Beyond the code, i am passionate about technical writing and simplifying the magic behind frameworks for other developers.