Okay, What is Redis?

Published: (April 3, 2026 at 01:51 AM EDT)
2 min read
Source: Dev.to

Source: Dev.to

What is Redis?

In simple words, Redis acts like a cache memory to store data as key‑value pairs. Without Redis, a website can take a long time to fetch data on each request. With Redis, the first fetch takes the normal amount of time, but subsequent fetches are much faster because the data is served from the cache.

Demo Tutorial

The following tutorial demonstrates the performance difference with and without Redis caching.

Setup

  1. Clone or copy the code from the GitHub Gist (link not included here).
  2. Open a terminal in the project’s root directory and run the commands below.
npm i
npm start

The application will be available at http://localhost:5000.
Visit:

http://localhost:5000/repos/

Replace “ with any GitHub username (e.g., arunkrish11) to see how many public repositories that user has.

Observing Fetch Times

  1. Open the browser’s developer tools and go to the Network tab.
  2. Look for the entry named finish time – this shows how long the request took to load.

Without Cache

Comment out (or remove) the cache‑checking block in the source code:

// 1. Check cache
const cached = await client.get(username);
if (cached) {
  return res.send(`
## ${username} has ${cached} repos (cached)
`);
}

Refresh the page repeatedly. You will notice that the fetch time remains high on each refresh because the request is hitting the GitHub API every time.

With Cache

Restore the cache‑checking block (the code you removed earlier). Now refresh the page:

  • First fetch – takes the normal amount of time as the data is retrieved from GitHub and stored in Redis.
  • Subsequent fetches – are much faster because the data is served from the Redis cache.

This demonstrates how Redis can dramatically improve response times for repeated requests.


End of tutorial.

0 views
Back to Blog

Related posts

Read more »

Stop Wasting Tokens on npm Install Noise

Problem Running npm install in a medium‑sized project often produces dozens of deprecation warnings, e.g.: text npm warn deprecated inflight@1.0.6: This module...