1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-10 07:42:26 +08:00

cache增加带Context版本,开放平台相关接口支持Context版本 (#653)

This commit is contained in:
okhowang
2023-04-03 20:32:44 +08:00
committed by GitHub
parent 01784c2a4a
commit 07b7dc40fc
7 changed files with 178 additions and 43 deletions

10
cache/redis_test.go vendored
View File

@@ -4,17 +4,23 @@ import (
"context"
"testing"
"time"
"github.com/alicebob/miniredis/v2"
)
func TestRedis(t *testing.T) {
server, err := miniredis.Run()
if err != nil {
t.Error("miniredis.Run Error", err)
}
t.Cleanup(server.Close)
var (
timeoutDuration = time.Second
ctx = context.Background()
opts = &RedisOpts{
Host: "127.0.0.1:6379",
Host: server.Addr(),
}
redis = NewRedis(ctx, opts)
err error
val = "silenceper"
key = "username"
)