Skip to content

Commit 43f6d16

Browse files
authored
docs: refine filter documentation (#907)
1 parent a8c472e commit 43f6d16

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/src/en/filter/filter.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@ RedisShake provides various built-in filter rules that users can choose from acc
77
## Filtering Keys
88
RedisShake supports filtering by key name, key name prefixes, and suffixes. You can set the following options in the configuration file, for example:
99
```toml
10+
[filter]
1011
allow_keys = ["user:1001", "product:2001"] # allowed key names
1112
allow_key_prefix = ["user:", "product:"] # allowed key name prefixes
1213
allow_key_suffix = [":active", ":valid"] # allowed key name suffixes
14+
allow_key_regex = [":\\d{11}:"] # allowed key name regex, 11-digit mobile phone number
1315
block_keys = ["temp:1001", "cache:2001"] # blocked key names
1416
block_key_prefix = ["temp:", "cache:"] # blocked key name prefixes
1517
block_key_suffix = [":tmp", ":old"] # blocked key name suffixes
18+
block_key_regex = [":test:\\d{11}:"] # blocked key name regex, 11-digit mobile phone number with "test" prefix
1619
```
1720
If these options are not set, all keys are allowed by default.
1821

1922
## Filtering Databases
2023
You can specify allowed or blocked database numbers, for example:
2124
```toml
25+
[filter]
2226
allow_db = [0, 1, 2]
2327
block_db = [3, 4, 5]
2428
```
@@ -27,6 +31,7 @@ If these options are not set, all databases are allowed by default.
2731
## Filtering Commands
2832
RedisShake allows you to filter specific Redis commands, for example:
2933
```toml
34+
[filter]
3035
allow_command = ["GET", "SET"]
3136
block_command = ["DEL", "FLUSHDB"]
3237
```
@@ -37,6 +42,7 @@ You can also filter by command groups. Available command groups include:
3742
SERVER, STRING, CLUSTER, CONNECTION, BITMAP, LIST, SORTED_SET, GENERIC, TRANSACTIONS, SCRIPTING, TAIRHASH, TAIRSTRING, TAIRZSET, GEO, HASH, HYPERLOGLOG, PUBSUB, SET, SENTINEL, STREAM
3843
For example:
3944
```toml
45+
[filter]
4046
allow_command_group = ["STRING", "HASH"]
4147
block_command_group = ["SCRIPTING", "PUBSUB"]
4248
```

docs/src/zh/filter/filter.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@ RedisShake 提供了多种内置的过滤规则,用户可以根据需要选择
77
## 过滤 Key
88
RedisShake 支持通过键名、键名前缀和后缀进行过滤。您可以在配置文件中设置以下选项,例如:
99
```toml
10+
[filter]
1011
allow_keys = ["user:1001", "product:2001"] # 允许的键名
1112
allow_key_prefix = ["user:", "product:"] # 允许的键名前缀
1213
allow_key_suffix = [":active", ":valid"] # 允许的键名后缀
14+
allow_key_regex = [":\\d{11}:"] # 允许的键名正则,11位手机号
1315
block_keys = ["temp:1001", "cache:2001"] # 阻止的键名
1416
block_key_prefix = ["temp:", "cache:"] # 阻止的键名前缀
1517
block_key_suffix = [":tmp", ":old"] # 阻止的键名后缀
18+
block_key_regex = [":test:\\d{11}:"] # 阻止的键名正则,11位手机号,前缀为test
1619
```
1720
如果不设置这些选项,默认允许所有键。
1821

1922
## 过滤数据库
2023
您可以指定允许或阻止的数据库编号,例如:
2124
```toml
25+
[filter]
2226
allow_db = [0, 1, 2]
2327
block_db = [3, 4, 5]
2428
```
@@ -27,6 +31,7 @@ block_db = [3, 4, 5]
2731
## 过滤命令
2832
RedisShake 允许您过滤特定的 Redis 命令,例如:
2933
```toml
34+
[filter]
3035
allow_command = ["GET", "SET"]
3136
block_command = ["DEL", "FLUSHDB"]
3237
```
@@ -37,6 +42,7 @@ block_command = ["DEL", "FLUSHDB"]
3742
SERVER, STRING, CLUSTER, CONNECTION, BITMAP, LIST, SORTED_SET, GENERIC, TRANSACTIONS, SCRIPTING, TAIRHASH, TAIRSTRING, TAIRZSET, GEO, HASH, HYPERLOGLOG, PUBSUB, SET, SENTINEL, STREAM
3843
例如:
3944
```toml
45+
[filter]
4046
allow_command_group = ["STRING", "HASH"]
4147
block_command_group = ["SCRIPTING", "PUBSUB"]
4248
```

0 commit comments

Comments
 (0)