Skip to content

Commit 104faa4

Browse files
committed
Merge branch 'main' into DOC-5941
2 parents 520ce60 + 68ab71a commit 104faa4

File tree

1,314 files changed

+32127
-8154
lines changed

Some content is hidden

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

1,314 files changed

+32127
-8154
lines changed

.github/workflows/k8s_apis_sync.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
k8s_apis_sync:
1717
runs-on: ubuntu-latest
1818
permissions:
19+
id-token: write
1920
contents: write
2021
pull-requests: write
2122
actions: write
@@ -38,11 +39,17 @@ jobs:
3839
tar -xvzf crdoc_Linux_x86_64.tar.gz
3940
sudo mv crdoc /bin/crdoc
4041
42+
- name: Configure AWS credentials
43+
uses: aws-actions/configure-aws-credentials@v4
44+
with:
45+
role-to-assume: arn:aws:iam::022044324644:role/GitHubRedisDocsS3Access
46+
aws-region: us-east-1
47+
4148
- name: 'Fetch release'
4249
run: |-
4350
RELEASE="${{ github.event.inputs.release }}"
4451
BUCKET_FOLDER="${{ github.event.inputs.bucket_folder }}"
45-
aws s3 cp "s3://redislabs-k8s/${BUCKET_FOLDER}/redis-enterprise-operator-${RELEASE}.tar.gz" --no-sign-request . --region us-east-1
52+
aws s3 cp "s3://redislabs-k8s/${BUCKET_FOLDER}/redis-enterprise-operator-${RELEASE}.tar.gz" .
4653
4754
tar xf "redis-enterprise-operator-${RELEASE}.tar.gz"
4855

.github/workflows/main.yml

Lines changed: 649 additions & 204 deletions
Large diffs are not rendered by default.

.github/workflows/update_command_pages.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install dependencies
2222
run: make deps
2323

24-
- name: 'Run build/update_cmds.py script'
24+
- name: 'Run build/cmd_tools.py update-all'
2525
env:
2626
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2727
run: |
@@ -44,7 +44,7 @@ jobs:
4444
git checkout -b "${branch}"
4545
fi
4646
47-
python3 build/update_cmds.py
47+
python3 build/cmd_tools.py update-all
4848
4949
commands_are_different=$(git diff "content/commands/")
5050

AGENT.md

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# Redis Guide for AI Agents
2+
3+
This document provides guidance for AI agents working with Redis, including key concepts, common patterns, and best practices.
4+
5+
## What is Redis?
6+
7+
Redis is an open-source, in-memory data structure store used as a database, cache, message broker, and streaming engine. It supports various data structures such as strings, hashes, lists, sets, sorted sets, bitmaps, hyperloglogs, geospatial indexes, and streams.
8+
9+
## Key Concepts
10+
11+
### Data Structures
12+
13+
- **Strings**: Binary-safe strings up to 512 MB
14+
- **Lists**: Collections of strings ordered by insertion order
15+
- **Sets**: Unordered collections of unique strings
16+
- **Sorted Sets**: Sets ordered by a score
17+
- **Hashes**: Maps of field-value pairs
18+
- **Streams**: Append-only log data structure
19+
- **Bitmaps**: Bit-level operations on strings
20+
- **HyperLogLogs**: Probabilistic data structure for cardinality estimation
21+
- **Geospatial**: Latitude/longitude coordinate storage and queries
22+
- **JSON**: Native JSON document storage (Redis Stack)
23+
24+
### Persistence
25+
26+
Redis offers multiple persistence options:
27+
- **RDB (Redis Database)**: Point-in-time snapshots
28+
- **AOF (Append Only File)**: Log of every write operation
29+
- **Hybrid**: Combination of RDB and AOF
30+
31+
### Replication and High Availability
32+
33+
- **Replication**: Master-replica architecture for read scaling and data redundancy
34+
- **Sentinel**: Automatic failover and monitoring
35+
- **Cluster**: Horizontal scaling with automatic sharding
36+
37+
## Common Use Cases
38+
39+
1. **Caching**: Store frequently accessed data to reduce database load
40+
2. **Session Management**: Store user session data
41+
3. **Real-time Analytics**: Count, rank, and aggregate data in real-time
42+
4. **Message Queues**: Pub/Sub messaging and stream processing
43+
5. **Leaderboards**: Sorted sets for ranking systems
44+
6. **Rate Limiting**: Track and limit API requests
45+
7. **Geospatial Applications**: Location-based queries
46+
8. **Vector Search**: Similarity search with Redis Stack
47+
48+
## Basic Commands
49+
50+
### String Operations
51+
```
52+
SET key value [EX seconds] [NX|XX]
53+
GET key
54+
INCR key
55+
DECR key
56+
MGET key1 key2 ...
57+
MSET key1 value1 key2 value2 ...
58+
```
59+
60+
### Hash Operations
61+
```
62+
HSET key field value
63+
HGET key field
64+
HMGET key field1 field2 ...
65+
HGETALL key
66+
HINCRBY key field increment
67+
```
68+
69+
### List Operations
70+
```
71+
LPUSH key value1 [value2 ...]
72+
RPUSH key value1 [value2 ...]
73+
LPOP key
74+
RPOP key
75+
LRANGE key start stop
76+
```
77+
78+
### Set Operations
79+
```
80+
SADD key member1 [member2 ...]
81+
SMEMBERS key
82+
SISMEMBER key member
83+
SINTER key1 key2 ...
84+
SUNION key1 key2 ...
85+
```
86+
87+
### Sorted Set Operations
88+
```
89+
ZADD key score1 member1 [score2 member2 ...]
90+
ZRANGE key start stop [WITHSCORES]
91+
ZRANK key member
92+
ZINCRBY key increment member
93+
```
94+
95+
### Key Management
96+
```
97+
DEL key1 [key2 ...]
98+
EXISTS key1 [key2 ...]
99+
EXPIRE key seconds
100+
TTL key
101+
KEYS pattern (use with caution in production)
102+
SCAN cursor [MATCH pattern] [COUNT count]
103+
```
104+
105+
## Best Practices for Agents
106+
107+
### 1. Connection Management
108+
- Use connection pooling for better performance
109+
- Close connections properly when done
110+
- Handle connection errors gracefully
111+
112+
### 2. Key Naming Conventions
113+
- Use descriptive, hierarchical names: `user:1000:profile`
114+
- Use colons (`:`) as separators
115+
- Keep keys reasonably short but readable
116+
- Include version numbers if schema changes: `user:v2:1000`
117+
118+
### 3. Performance Optimization
119+
- Use pipelining for multiple commands
120+
- Prefer `SCAN` over `KEYS` in production
121+
- Use appropriate data structures for your use case
122+
- Set expiration times on temporary data
123+
- Use `MGET`/`MSET` for batch operations
124+
125+
### 4. Data Modeling
126+
- Denormalize data for read performance
127+
- Use hashes for objects with multiple fields
128+
- Use sorted sets for rankings and time-series data
129+
- Consider memory usage when choosing data structures
130+
131+
### 5. Error Handling
132+
- Always check command return values
133+
- Handle `nil` responses appropriately
134+
- Implement retry logic for transient failures
135+
- Use transactions (MULTI/EXEC) for atomic operations
136+
137+
### 6. Security
138+
- Never expose Redis directly to the internet
139+
- Use ACLs (Access Control Lists) for authentication
140+
- Enable TLS for encrypted connections
141+
- Rename or disable dangerous commands in production
142+
143+
## Common Patterns
144+
145+
### Caching Pattern
146+
```
147+
GET cache_key
148+
if nil:
149+
data = fetch_from_database()
150+
SET cache_key data EX 3600
151+
return data
152+
else:
153+
return cached_data
154+
```
155+
156+
### Rate Limiting Pattern
157+
```
158+
key = "rate_limit:user:" + user_id + ":" + current_minute
159+
count = INCR key
160+
if count == 1:
161+
EXPIRE key 60
162+
if count > limit:
163+
return "rate limit exceeded"
164+
```
165+
166+
### Distributed Lock Pattern
167+
```
168+
SET lock_key unique_value NX EX 10
169+
if success:
170+
# perform critical section
171+
# release lock only if we own it
172+
DEL lock_key (with Lua script to verify ownership)
173+
```
174+
175+
## Resources in This Repository
176+
177+
- `/content/commands/`: Complete command reference
178+
- `/content/develop/`: Development guides and tutorials
179+
- `/content/operate/`: Operational guides for deployment and management
180+
- `/content/integrate/`: Integration guides for various languages and frameworks
181+
182+
## Version-Specific Features
183+
184+
Redis evolves with each version. Check the version-specific command references:
185+
- Redis 8.6: Latest features including HOTKEYS command
186+
- Redis 8.4: Previous stable release
187+
- Redis 8.2, 8.0: Earlier 8.x releases
188+
- Redis 7.4, 7.2: 7.x series
189+
- Redis 6.2: Long-term support release
190+
191+
## Getting Help
192+
193+
When working with Redis commands:
194+
1. Check the command documentation in `/content/commands/`
195+
2. Look for code examples in `/content/develop/`
196+
3. Review integration guides for your programming language
197+
4. Consider the Redis version you're targeting
198+
199+
## Important Notes
200+
201+
- Redis is single-threaded for command execution (though I/O is multi-threaded in recent versions)
202+
- All data is stored in memory (with optional persistence to disk)
203+
- Commands are atomic
204+
- Use Lua scripts for complex atomic operations
205+
- Redis Cluster has some limitations (e.g., multi-key operations must be on the same hash slot)
206+

assets/css/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,10 @@ select {
442442
min-height: 32px;
443443
}
444444

445+
.cli-footer.commands-foldout-open {
446+
@apply opacity-100 visible;
447+
}
448+
445449
.cli-footer a.rounded {
446450
@apply bg-red-900/80 hover:bg-red-700/80 text-white;
447451
}

0 commit comments

Comments
 (0)