Skip to content

Commit 37c16ab

Browse files
Merge pull request #53 from dwdougherty/tutorial/RI-5759
A few editorial changes
2 parents 5986235 + c7942fb commit 37c16ab

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/uc/intro.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ If you haven't done so already, you can upload the sample data related to this t
77

88
### Matchmaking
99

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.
1111

1212
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.
1313

14-
```redis:[run_confirmation=true]
14+
```redis:[run_confirmation=true] Add a bike as JSON
1515
// Add a bike as JSON
1616
JSON.SET sample_bicycle:2048 $ '{
1717
"model": "Ranger",
@@ -33,7 +33,7 @@ JSON.SET sample_bicycle:2048 $ '{
3333

3434
In Redis, you can easily index these attributes and perform complex queries efficiently.
3535

36-
```redis:[run_confirmation=true]
36+
```redis:[run_confirmation=true] Create a bike index
3737
// Create a secondary index of your bike data
3838
FT.CREATE idx:smpl_bicycle
3939
ON JSON
@@ -52,7 +52,7 @@ FT.CREATE idx:smpl_bicycle
5252

5353
You can then easily match a user to their preferred type of bike within a requested price bracket.
5454

55-
```redis:[run_confirmation=true]
55+
```redis:[run_confirmation=true] Search for a match
5656
// Match leisure bikes within a price of 200 and 300
5757
FT.SEARCH idx:smpl_bicycle "@type:{mountain} @price:[400 450]" RETURN 4 brand model type price
5858
```
@@ -61,65 +61,65 @@ FT.SEARCH idx:smpl_bicycle "@type:{mountain} @price:[400 450]" RETURN 4 brand mo
6161

6262
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
6363

64-
```redis:[run_confirmation=true]
64+
```redis:[run_confirmation=true] Add a restaurant
6565
// Add a restaurant as JSON
6666
JSON.SET sample_restaurant:341 $ '{
6767
"name": "Zen Galushca",
6868
"cuisine": "Japanese",
6969
"location": "-98.1221,30.8232"
7070
}'
7171
```
72-
```redis:[run_confirmation=true]
72+
```redis:[run_confirmation=true] Create a restaurant index
7373
//Create an index of your restaurant data
7474
FT.CREATE "idx:smpl_restaurant"
7575
ON JSON
7676
PREFIX 1 "sample_restaurant:"
7777
SCHEMA
7878
"$.cuisine" AS "cuisine" TAG
79-
"$.name" AS "restaunt_name" TEXT
79+
"$.name" AS "restaurant_name" TEXT
8080
"$.location" AS "location" GEO
8181
```
8282

83-
```redis:[run_confirmation=true]
83+
```redis:[run_confirmation=true] Search for a restaurant
8484
// Find a Japanese restaurant within a 50 mile radius
85-
FT.SEARCH idx:smpl_restaurant "@cuisine:{japanese} @location:[-98.1179,30.671 50 mi]" RETURN 2 restaunt_name location
85+
FT.SEARCH idx:smpl_restaurant "@cuisine:{japanese} @location:[-98.1179,30.671 50 mi]" RETURN 2 restaurant_name location
8686
```
8787

8888
### Session store
8989

90-
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.
9191

92-
```redis:[run_confirmation=true]
92+
```redis:[run_confirmation=true] Create a session hash with expiration
9393
// Store new session
9494
HSET sample_session:074529275 user_id 7254 username gabe_jones email gabe@example.com last_activity "2024-06-01 10:24:00"
9595
9696
// Set an expiration time for the new session entry
9797
EXPIRE sample_session:074529275 7344000
9898
```
9999

100-
```redis:[run_confirmation=true]
100+
```redis:[run_confirmation=true] Retrieve a session
101101
// Retrieve an existing session
102102
HGETALL sample_session:074529275
103103
```
104104

105105
### Job queue
106106

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).
108108

109109

110-
```redis:[run_confirmation=true]
110+
```redis:[run_confirmation=true] Create a job ticket
111111
// Create a new job as a Hash
112112
HSET sample_jobQueue:ticket:199 id 199 user_id 723 description "Unable to access console" priority "High" created_at "2024-04-20T12:00:00Z"
113113
```
114-
```redis:[run_confirmation=true]
114+
```redis:[run_confirmation=true] Enqueue job
115115
// Enqueue the new job to the waiting list
116116
LPUSH sample_jobQueue:waitingList sample_jobQueue:ticket:199
117117
```
118-
```redis:[run_confirmation=true]
118+
```redis:[run_confirmation=true] Show all jobs
119119
// Show the full list of jobs
120120
LRANGE sample_jobQueue:waitingList 0 -1
121121
```
122-
```redis:[run_confirmation=true]
122+
```redis:[run_confirmation=true] Dequeue a job
123123
// Dequeue a job from the list
124124
RPOP sample_jobQueue:waitingList
125125
```
@@ -128,12 +128,12 @@ RPOP sample_jobQueue:waitingList
128128

129129
[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.
130130

131-
```redis:[run_confirmation=true]
131+
```redis:[run_confirmation=true] Create a leaderboard score
132132
// Add a new score to leaderboard
133133
ZADD sample_leaderboard:tetris 670000 "user100"
134134
```
135135

136-
```redis:[run_confirmation=true]
136+
```redis:[run_confirmation=true] Get users with scores
137137
// Get the top 5 users on the leaderboard, with scores
138138
ZRANGE sample_leaderboard:tetris 0 4 REV WITHSCORES
139139
```

0 commit comments

Comments
 (0)