You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/uc/intro.md
+19-19Lines changed: 19 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,11 @@ If you haven't done so already, you can upload the sample data related to this t
7
7
8
8
### Matchmaking
9
9
10
-
Redis serves as a powerful document store, well-suited for matchmaking use cases. For instance, consider a bike shop where you need to pair shoppers with bikes based on their preferences and budget.
10
+
Redis serves as a powerful document store that is well-suited for matchmaking use cases. For instance, consider a bike shop where you need to pair shoppers with bikes based on their preferences and budget.
11
11
12
12
You can store your bike inventory using the JSON data structure, where bikes have attributes such as type (e.g., mountain, road, electric), condition (new or used), price, etc.
13
13
14
-
```redis:[run_confirmation=true]
14
+
```redis:[run_confirmation=true] Add a bike as JSON
Location-based search involves finding and retrieving data that is relevant to a specific geographic location. Redis can be used to power location-based search applications by storing and indexing geospatial data, such as latitude and longitude coordinates, and providing fast and efficient search capabilities
63
63
64
-
```redis:[run_confirmation=true]
64
+
```redis:[run_confirmation=true]Add a restaurant
65
65
// Add a restaurant as JSON
66
66
JSON.SET sample_restaurant:341 $ '{
67
67
"name": "Zen Galushca",
68
68
"cuisine": "Japanese",
69
69
"location": "-98.1221,30.8232"
70
70
}'
71
71
```
72
-
```redis:[run_confirmation=true]
72
+
```redis:[run_confirmation=true]Create a restaurant index
73
73
//Create an index of your restaurant data
74
74
FT.CREATE "idx:smpl_restaurant"
75
75
ON JSON
76
76
PREFIX 1 "sample_restaurant:"
77
77
SCHEMA
78
78
"$.cuisine" AS "cuisine" TAG
79
-
"$.name" AS "restaunt_name" TEXT
79
+
"$.name" AS "restaurant_name" TEXT
80
80
"$.location" AS "location" GEO
81
81
```
82
82
83
-
```redis:[run_confirmation=true]
83
+
```redis:[run_confirmation=true]Search for a restaurant
84
84
// Find a Japanese restaurant within a 50 mile radius
Redis shines as a session store, offering speed and scalability for web applications. Using commands like HSET to store session data as Hash and HGET to retrieve it, Redis ensures rapid access to user sessions.
90
+
Redis shines as a session store, offering speed and scalability for web applications. Using commands like HSET to store session data as hashes and HGET to retrieve it, Redis ensures rapid access to user sessions.
91
91
92
-
```redis:[run_confirmation=true]
92
+
```redis:[run_confirmation=true] Create a session hash with expiration
// Set an expiration time for the new session entry
97
97
EXPIRE sample_session:074529275 7344000
98
98
```
99
99
100
-
```redis:[run_confirmation=true]
100
+
```redis:[run_confirmation=true]Retrieve a session
101
101
// Retrieve an existing session
102
102
HGETALL sample_session:074529275
103
103
```
104
104
105
105
### Job queue
106
106
107
-
In many applications, tasks need to be processed asynchronously, such as maintaining a waiting list for a helpdesk where incoming support tickets are queued for processing. A job queue helps manage these tasks efficiently. In Redis, a [job queue](https://redis.io/glossary/redis-queue/) can be implemented using the List data structure. When a new task needs to be queued, it is added to the left end of the list (using LPUSH command). When a worker is ready to process a task, it dequeues it from the right end of the list (using RPOP command).
107
+
In many applications, tasks need to be processed asynchronously, such as maintaining a waiting list for a helpdesk where incoming support tickets are queued for processing. A job queue helps manage these tasks efficiently. In Redis, a [job queue](https://redis.io/glossary/redis-queue/) can be implemented using the List data structure. When a new task needs to be queued, it is added to the left end of the list (using the LPUSH command). When a worker is ready to process a task, it dequeues it from the right end of the list (using the RPOP command).
108
108
109
109
110
-
```redis:[run_confirmation=true]
110
+
```redis:[run_confirmation=true] Create a job ticket
111
111
// Create a new job as a Hash
112
112
HSET sample_jobQueue:ticket:199 id 199 user_id 723 description "Unable to access console" priority "High" created_at "2024-04-20T12:00:00Z"
[Leaderboards](https://redis.io/solutions/leaderboards/) are crucial for gaming applications to display rankings based on scores. Sorted Sets in Redis are perfect for this purpose due to their ability to store elements with associated scores, which can be easily queried and sorted.
130
130
131
-
```redis:[run_confirmation=true]
131
+
```redis:[run_confirmation=true] Create a leaderboard score
132
132
// Add a new score to leaderboard
133
133
ZADD sample_leaderboard:tetris 670000 "user100"
134
134
```
135
135
136
-
```redis:[run_confirmation=true]
136
+
```redis:[run_confirmation=true] Get users with scores
137
137
// Get the top 5 users on the leaderboard, with scores
0 commit comments