Skip to content

Commit 5242a99

Browse files
Adds use cases doc
1 parent 22e852e commit 5242a99

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/docs/use_cases.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: "JSON Use cases"
3+
linkTitle: "title: "JSON Use cases""
4+
weight: 4
5+
description: >
6+
Learn how to use query syntax
7+
aliases:
8+
- /docs/stack/search/reference/query_syntax/
9+
---
10+
11+
You can of course use Redis native data structures to store JSON objects, and that's a common practice. For example, you can serialize JSON and save it in a Redis String.
12+
13+
However, RedisJSON provides several benefits over this approach.
14+
15+
**Access and retrieval of subvalues**
16+
17+
With RedisJSON, you can get nested values without having to transmit the entire object over the network. Being able to access sub-objects can lead to greater efficiencies when you're storing large JSON objects in Redis.
18+
19+
**Atomic partial updates**
20+
21+
RedisJSON allows you to atomically run operations like incrementing a value, adding, or removing elements from an array, append strings, and so on. To do the same with a serialized object, you have to retrieve and then reserialize the entire object, which can be expensive and also lack atomicity.
22+
23+
**Indexing and querying**
24+
25+
When you store JSON objects as Redis strings, there's no good way to query those objects. On the other hand, storing these objects as JSON using RedisJSON lets you index and query them. This is provided by RediSearch.

0 commit comments

Comments
 (0)