mirror of
https://github.com/ByteByteGoHq/system-design-101.git
synced 2026-04-10 20:17:23 -04:00
This PR adds all the guides from [Visual Guides](https://bytebytego.com/guides/) section on bytebytego to the repository with proper links. - [x] Markdown files for guides and categories are placed inside `data/guides` and `data/categories` - [x] Guide links in readme are auto-generated using `scripts/readme.ts`. Everytime you run the script `npm run update-readme`, it reads the categories and guides from the above mentioned folders, generate production links for guides and categories and populate the table of content in the readme. This ensures that any future guides and categories will automatically get added to the readme. - [x] Sorting inside the readme matches the actual category and guides sorting on production
59 lines
1.3 KiB
Markdown
59 lines
1.3 KiB
Markdown
---
|
|
title: "How can Redis be used?"
|
|
description: "Explore various use cases of Redis beyond caching."
|
|
image: "https://assets.bytebytego.com/diagrams/0388-how-can-redis-be-used.png"
|
|
createdAt: "2024-03-06"
|
|
draft: false
|
|
categories:
|
|
- caching-performance
|
|
tags:
|
|
- Redis
|
|
- Use Cases
|
|
---
|
|
|
|

|
|
|
|
There is more to Redis than just caching.
|
|
|
|
Redis can be used in a variety of scenarios as shown in the diagram.
|
|
|
|
* **Session**
|
|
|
|
We can use Redis to share user session data among different services.
|
|
|
|
* **Cache**
|
|
|
|
We can use Redis to cache objects or pages, especially for hotspot data.
|
|
|
|
* **Distributed lock**
|
|
|
|
We can use a Redis string to acquire locks among distributed services.
|
|
|
|
* **Counter**
|
|
|
|
We can count how many likes or how many reads for articles.
|
|
|
|
* **Rate limiter**
|
|
|
|
We can apply a rate limiter for certain user IPs.
|
|
|
|
* **Global ID generator**
|
|
|
|
We can use Redis Int for global ID.
|
|
|
|
* **Shopping cart**
|
|
|
|
We can use Redis Hash to represent key-value pairs in a shopping cart.
|
|
|
|
* **Calculate user retention**
|
|
|
|
We can use Bitmap to represent the user login daily and calculate user retention.
|
|
|
|
* **Message queue**
|
|
|
|
We can use List for a message queue.
|
|
|
|
* **Ranking**
|
|
|
|
We can use ZSet to sort the articles.
|