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
**Redis** is a powerful in-memory data structure store that can be used for various use cases due to its speed, simplicity, and versatility. In this tutorial, we'll explore several common use cases: matchmaking, location-based search, job queue, leaderboard, and session store.
1
+
**Redis** is a powerful in-memory data structure store that can be used for various use cases due to its speed, simplicity, and versatility. In this tutorial, we'll explore several common use cases: matchmaking, job queue, leaderboard, and session store.
2
2
3
3
If you haven't done so already, you can upload the sample data related to this tutorial by clicking the button below. You will also need support for [JSON](https://redis.io/docs/latest/develop/data-types/json/) and [Search & query](https://redis.io/docs/latest/develop/interact/search-and-query/) in your database to take advantage of this tutorial fully.
4
4
@@ -13,7 +13,7 @@ You can store your bike inventory using the JSON data structure, where bikes hav
13
13
14
14
```redis:[run_confirmation=true] Add a bike as JSON
15
15
// Add a bike as JSON
16
-
JSON.SET sample_bicycle:2048 $ '{
16
+
JSON.SET bicycle:2048 $ '{
17
17
"model": "Ranger",
18
18
"brand": "TrailBlazer",
19
19
"price": 450,
@@ -35,9 +35,9 @@ In Redis, you can easily index these attributes and perform complex queries effi
35
35
36
36
```redis:[run_confirmation=true] Create a bike index
37
37
// Create a secondary index of your bike data
38
-
FT.CREATE idx:smpl_bicycle
38
+
FT.CREATE idx:bicycle
39
39
ON JSON
40
-
PREFIX 1 sample_bicycle:
40
+
PREFIX 1 bicycle:
41
41
SCHEMA
42
42
$.brand AS brand TEXT
43
43
$.model AS model TEXT
@@ -54,35 +54,7 @@ You can then easily match a user to their preferred type of bike within a reques
54
54
55
55
```redis:[run_confirmation=true] Search for a match
56
56
// Match leisure bikes within a price of 200 and 300
57
-
FT.SEARCH idx:smpl_bicycle "@type:{mountain} @price:[400 450]" RETURN 4 brand model type price
58
-
```
59
-
60
-
### Location-based search
61
-
62
-
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
-
64
-
```redis:[run_confirmation=true] Add a restaurant
65
-
// Add a restaurant as JSON
66
-
JSON.SET sample_restaurant:341 $ '{
67
-
"name": "Zen Galushca",
68
-
"cuisine": "Japanese",
69
-
"location": "-98.1221,30.8232"
70
-
}'
71
-
```
72
-
```redis:[run_confirmation=true] Create a restaurant index
73
-
//Create an index of your restaurant data
74
-
FT.CREATE "idx:smpl_restaurant"
75
-
ON JSON
76
-
PREFIX 1 "sample_restaurant:"
77
-
SCHEMA
78
-
"$.cuisine" AS "cuisine" TAG
79
-
"$.name" AS "restaurant_name" TEXT
80
-
"$.location" AS "location" GEO
81
-
```
82
-
83
-
```redis:[run_confirmation=true] Search for a restaurant
84
-
// Find a Japanese restaurant within a 50 mile radius
0 commit comments