diff --git a/pages/practice.md b/pages/practice.md
index 79001ad..5e4bd16 100644
--- a/pages/practice.md
+++ b/pages/practice.md
@@ -54,6 +54,11 @@ layout: default
## 最佳实践 容器化服务
+
+
+
+
+
```yaml
name: Redis
on: push
@@ -61,21 +66,71 @@ on: push
jobs:
runner-job:
runs-on: ubuntu-latest
- containers:
- - image: redis
services:
redis:
image: redis
ports:
- 6379:6379
-
+
steps:
- - name: Run Redis
- run: |
- redis-cli ping
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Install Go
+ uses: actions/setup-go@v3
+ - run: go version
+
+ - name: Run main.go
+ run: cd redis && go run main.go
+```
+
+
+
+
+```go
+package main
+
+import (
+ "context"
+ "time"
+
+ redis "github.com/redis/go-redis/v9"
+)
+
+var ctx = context.Background()
+
+func main() {
+ rdb := redis.NewClient(&redis.Options{
+ Addr: "localhost:6379",
+ })
+
+ if err := rdb.Set(ctx, "test", time.Now().String(), time.Second*10).Err(); err != nil {
+ panic(err)
+ }
+
+ if result := rdb.Get(ctx, "test"); result.Err() != nil {
+ panic(result.Err())
+ } else {
+ println(result.Val())
+ }
+}
```
+
+
+
+
+---
+
+