Skip to content

Commit 7b4db56

Browse files
committed
Merge branch 'main' into release-rs-apr
2 parents 1fe8192 + 3aeb5a5 commit 7b4db56

File tree

383 files changed

+5059
-3808
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

383 files changed

+5059
-3808
lines changed

.github/workflows/redisvl_docs_sync.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
3535
# Get latest release
3636
latest_release=$(gh release -R redis/redis-vl-python list --json name,isLatest --jq '.[] | select(.isLatest)|.name')
37-
git checkout "tags/${latest_release}"
37+
git checkout "tags/${latest_release}" || git checkout "tags/v${latest_release}"
3838
pip3 install -e .
3939
4040
popd
@@ -107,13 +107,15 @@ jobs:
107107
108108
# Convert jupyter notebooks to markdown
109109
jupyter nbconvert --to markdown build/jupyter_execute/user_guide/*.ipynb --output-dir redis_vl_hugo/user_guide/ 2>/dev/null
110+
jupyter nbconvert --to markdown build/jupyter_execute/user_guide/release_guide/*.ipynb --output-dir redis_vl_hugo/user_guide/release_guide/ 2>/dev/null
110111
jupyter nbconvert --to markdown build/jupyter_execute/overview/cli.ipynb --output-dir redis_vl_hugo/overview/ 2>/dev/null
111112
112113
# Prepare markdown files
113114
rsync -a ./build/markdown/api/ ./redis_vl_hugo/api/ --exclude=index.md
114115
cp ./build/markdown/overview/installation.md ./redis_vl_hugo/overview/installation.md
115116
116117
# Format markdown files
118+
shopt -s globstar
117119
markdown_pages=(./redis_vl_hugo/**/*.md)
118120
119121
for markdown_page in "${markdown_pages[@]}"; do
@@ -208,19 +210,21 @@ jobs:
208210
# Format _index.md pages
209211
cp ./build/markdown/api/index.md ./redis_vl_hugo/api/_index.md
210212
cp ./build/markdown/user_guide/index.md ./redis_vl_hugo/user_guide/_index.md
213+
cp ./build/markdown/user_guide/release_guide/index.md ./redis_vl_hugo/user_guide/release_guide/_index.md
211214
cp ./build/markdown/overview/index.md ./redis_vl_hugo/overview/_index.md
212215
213216
index_markdown_pages=(
214217
./redis_vl_hugo/api/_index.md
215218
./redis_vl_hugo/user_guide/_index.md
219+
./redis_vl_hugo/user_guide/release_guide/_index.md
216220
./redis_vl_hugo/overview/_index.md
217221
)
218222
219223
for index_markdown_page in "${index_markdown_pages[@]}"; do
220224
format "${index_markdown_page}"
221225
222226
# Fix relrefs by removing .md extension and references to numbered pages
223-
sed -E -i 's/\.md/\//g; s/\([0-9]+_/\(/g' "${index_markdown_page}"
227+
sed -E -i 's/\.md/\//g; s/\([0-9]{2}_/\(/g; s/\/index\//\//g' "${index_markdown_page}"
224228
done
225229
226230
# Rename user guides to strip leading numbers from filename

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ The `filename` property value can be any file name path which is relative to the
102102
We added a new property `class` which allows you to override the CSS class of the image. Images have by default a `block` display in Tailwind. You can change this by setting the class property to `inline`. The following example shows two images that are in a single line:
103103

104104
```
105-
{{< image filename="/images/rc/icon-database-update-status-pending.png#no-click" alt="Pending database status" class="inline" >}} &nbsp; {{< image filename="/images/rc/icon-database-update-status-active.png#no-click" alt="Active database status" class="inline" >}}
105+
{{< image filename="/images/rc/icon-database-update-status-pending.png#no-click" alt="Pending database status" class="inline" >}} &nbsp; {{< image filename="/images/rc/icon-database-status-active.png#no-click" alt="Active database status" class="inline" >}}
106106
```
107107

108108
### Templating

build/image_report.py

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@
77
import os
88

99

10-
def scan_file(path: str) -> int:
10+
def scan_file(path: str, verbose: bool = True) -> list:
1111
"""Scans a file for all `image` shortcodes.
1212
1313
Args:
1414
path (str): Path to file.
15+
verbose (bool, optional): If True, prints the shortcodes found. Defaults to True.
1516
1617
Returns:
17-
(int) Number of shortcodes found.
18+
(list) A list of all image shortcodes found.
1819
"""
1920

2021
img_list = []
22+
img_names = []
2123

2224
with open(path, encoding="utf_8") as md_file:
2325
text = md_file.read()
@@ -26,16 +28,18 @@ def scan_file(path: str) -> int:
2628
text, lambda t: t.tag == "image"
2729
):
2830
img_list.append((img, pos_info))
31+
img_names.append(img.named_params["filename"])
2932

30-
if len(img_list) > 0:
33+
if len(img_list) > 0 and verbose:
3134
print(f"File '{path}':")
3235

3336
for img in img_list:
3437
print(
3538
f" Line {img[1].line}: '{img[0].named_params['filename']}'"
3639
)
3740

38-
return len(img_list)
41+
# return len(img_list)
42+
return img_names
3943

4044

4145
parser = argparse.ArgumentParser(
@@ -44,20 +48,50 @@ def scan_file(path: str) -> int:
4448
)
4549

4650
parser.add_argument("pathname", help="Path of the folder to scan")
51+
parser.add_argument("--find-unused", nargs=1, help="Prints out all images in IMAGEFOLDER that are not found in pathname. Set pathname to the top content folder to scan all content for images.", metavar="IMAGEFOLDER")
4752

4853
args = parser.parse_args()
4954

5055
print(f"Scanning '{args.pathname}'")
5156

5257
num_found = 0
58+
all_images_found = []
5359

5460
for root, dirs, files in os.walk(args.pathname):
5561
for file in files:
5662
if file.endswith(".md"):
5763
fullpath = os.path.join(root, file)
58-
num_found += scan_file(fullpath)
64+
images_found = scan_file(fullpath, verbose=args.find_unused is None)
65+
num_found += len(images_found)
66+
all_images_found.extend(images_found)
5967

6068
if num_found == 0:
6169
print(f"No image shortcodes found in '{args.pathname}'")
6270
else:
6371
print(f"Found {num_found} image shortcodes.")
72+
73+
if args.find_unused and num_found > 0:
74+
unique_images = list(set(all_images_found))
75+
print(f"Found {len(unique_images)} unique images in '{args.pathname}'.")
76+
print(f"Checking for images not found in '{args.pathname}' that are in '{args.find_unused[0]}'")
77+
78+
unused_images = []
79+
total_images = 0
80+
81+
for root, dirs, files in os.walk(args.find_unused[0]):
82+
for file in files:
83+
if (file.endswith(".png") or file.endswith(".jpg") or file.endswith(".webp")):
84+
total_images += 1
85+
if not any(file in img for img in unique_images):
86+
img_filepath = os.path.join(root, file)
87+
print(f" Image '{img_filepath}' not found in '{args.pathname}'")
88+
unused_images.append(img_filepath)
89+
90+
print(f"Found {len(unused_images)} unused images out of {total_images} images in '{args.find_unused[0]}.'")
91+
92+
if len(unused_images) > 0:
93+
print("Do you want to remove these images? (y/n) (DO NOT DO ON MAIN BRANCH!)")
94+
if input().lower() == "y":
95+
for img in unused_images:
96+
os.remove(img)
97+
print(f"Removed '{img}'")

config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ rdi_redis_gears_version = "1.2.6"
5555
rdi_debezium_server_version = "2.3.0.Final"
5656
rdi_db_types = "cassandra|mysql|oracle|postgresql|sqlserver"
5757
rdi_cli_latest = "latest"
58-
rdi_current_version = "v1.6.6"
58+
rdi_current_version = "v1.6.7"
5959

6060
[params.clientsConfig]
6161
"Python"={quickstartSlug="redis-py"}

content/commands/client-list/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ Here is the meaning of the fields:
117117
* `rbp`: peak size of the client's read buffer since the client connected. Added in Redis 7.0
118118
* `rbs`: current size of the client's read buffer in bytes. Added in Redis 7.0
119119
* `io-thread`: id of I/O thread assigned to the client. Added in Redis 8.0
120+
* `tot-net-in`: total network input bytes read from this client.
121+
* `tot-net-out`: total network output bytes sent to this client.
122+
* `tot-cmds`: total count of commands this client executed.
120123

121124
The client flags can be a combination of:
122125

content/commands/json.debug-memory/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ title: JSON.DEBUG MEMORY
3535
---
3636
Report a value's memory usage in bytes
3737

38+
{{< warning >}}
39+
The actual total memory consumption by a key could be much lower than the value reported by this command because of an internal JSON string reuse mechanism. For more information, see the [JSON memory usage page]({{< relref "/develop/data-types/json/ram#json-string-reuse-mechanism" >}}).
40+
{{< /warning >}}
41+
3842
[Examples](#examples)
3943

4044
## Required arguments

content/commands/spublish/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ title: SPUBLISH
5252
Posts a message to the given shard channel.
5353

5454
In Redis Cluster, shard channels are assigned to slots by the same algorithm used to assign keys to slots.
55-
A shard message must be sent to a node that own the slot the shard channel is hashed to.
56-
The cluster makes sure that published shard messages are forwarded to all the node in the shard, so clients can subscribe to a shard channel by connecting to any one of the nodes in the shard.
55+
A shard message must be sent to a node that owns the slot the shard channel is hashed to.
56+
The cluster makes sure that published shard messages are forwarded to all the nodes in the shard, so clients can subscribe to a shard channel by connecting to any one of the nodes in the shard.
5757

5858
For more information about sharded pubsub, see [Sharded Pubsub]({{< relref "/develop/interact/pubsub#sharded-pubsub" >}}).
5959

6060
## Examples
6161

62-
For example the following command publish to channel `orders` with a subscriber already waiting for message(s).
62+
For example the following command publishes to the `orders` channel with a subscriber already waiting for message(s).
6363

6464
```
6565
> spublish orders hello

content/develop/clients/dotnet/condexec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ categories:
1212
description: Understand how `NRedisStack` uses conditional execution
1313
linkTitle: Conditional execution
1414
title: Conditional execution
15-
weight: 6
15+
weight: 60
1616
---
1717

1818
Most Redis client libraries use transactions with the

content/develop/clients/dotnet/connect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ categories:
1212
description: Connect your .NET application to a Redis database
1313
linkTitle: Connect
1414
title: Connect to the server
15-
weight: 2
15+
weight: 20
1616
---
1717

1818
## Basic connection
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
categories:
3+
- docs
4+
- develop
5+
- stack
6+
- oss
7+
- rs
8+
- rc
9+
- oss
10+
- kubernetes
11+
- clients
12+
description: Get your NRedisStack app ready for production
13+
linkTitle: Production usage
14+
title: Production usage
15+
weight: 70
16+
---
17+
18+
This guide offers recommendations to get the best reliability and
19+
performance in your production environment.
20+
21+
## Checklist
22+
23+
Each item in the checklist below links to the section
24+
for a recommendation. Use the checklist icons to record your
25+
progress in implementing the recommendations.
26+
27+
{{< checklist "dotnetprodlist" >}}
28+
{{< checklist-item "#event-handling" >}}Event handling{{< /checklist-item >}}
29+
{{< checklist-item "#timeouts" >}}Timeouts{{< /checklist-item >}}
30+
{{< checklist-item "#exception-handling" >}}Exception handling{{< /checklist-item >}}
31+
{{< /checklist >}}
32+
33+
## Recommendations
34+
35+
The sections below offer recommendations for your production environment. Some
36+
of them may not apply to your particular use case.
37+
38+
### Event handling
39+
40+
The `ConnectionMultiplexer` class publishes several different types of
41+
[events](https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/events/)
42+
for situations such as configuration changes and connection failures.
43+
Use these events to record server activity in a log, which you can then use
44+
to monitor performance and diagnose problems when they occur.
45+
See
46+
the StackExchange.Redis
47+
[Events](https://stackexchange.github.io/StackExchange.Redis/Events)
48+
page for the full list of events.
49+
50+
#### Server notification events
51+
52+
Some servers (such as Azure Cache for Redis) send notification events shortly
53+
before scheduled maintenance is due to happen. You can use code like the
54+
following to respond to these events (see the
55+
[StackExchange.Redis](https://stackexchange.github.io/StackExchange.Redis/ServerMaintenanceEvent)
56+
docs for the full list of supported events). For example, you could
57+
inform users who try to connect that service is temporarily unavailable
58+
rather than letting them run into errors.
59+
60+
```cs
61+
using NRedisStack;
62+
using StackExchange.Redis;
63+
64+
ConnectionMultiplexer muxer = ConnectionMultiplexer.Connect("localhost:6379");
65+
66+
muxer.ServerMaintenanceEvent += (object sender, ServerMaintenanceEvent e) => {
67+
// Identify the event and respond to it here.
68+
Console.WriteLine($"Maintenance event: {e.RawMessage}");
69+
};
70+
```
71+
72+
### Timeouts
73+
74+
If a network or server error occurs while your code is opening a
75+
connection or issuing a command, it can end up hanging indefinitely.
76+
To prevent this, `NRedisStack` sets timeouts for socket
77+
reads and writes and for opening connections.
78+
79+
By default, the timeout is five seconds for all operations, but
80+
you can set the time (in milliseconds) separately for connections
81+
and commands using the `ConnectTimeout`, `SyncTimeout`, and
82+
`AsyncTimeout` configuration options:
83+
84+
```cs
85+
var muxer = ConnectionMultiplexer.Connect(new ConfigurationOptions {
86+
ConnectTimeout = 1000, // 1 second timeout for connections.
87+
SyncTimeout = 2000, // 2 seconds for synchronous commands.
88+
AsyncTimeout = 3000 // 3 seconds for asynchronous commands.
89+
.
90+
.
91+
});
92+
93+
var db = muxer.GetDatabase();
94+
```
95+
96+
The default timeouts are a good starting point, but you may be able
97+
to improve performance by adjusting the values to suit your use case.
98+
99+
### Exception handling
100+
101+
Redis handles many errors using return values from commands, but there
102+
are also situations where exceptions can be thrown. In production code,
103+
you should handle exceptions as they occur. The list below describes some
104+
the most common Redis exceptions:
105+
106+
- `RedisConnectionException`: Thrown when a connection attempt fails.
107+
- `RedisTimeoutException`: Thrown when a command times out.
108+
- `RedisCommandException`: Thrown when you issue an invalid command.
109+
- `RedisServerException`: Thrown when you attempt an invalid operation
110+
(for example, trying to access a
111+
[stream entry]({{< relref "/develop/data-types/streams#entry-ids" >}})
112+
using an invalid ID).

0 commit comments

Comments
 (0)