update
This commit is contained in:
@@ -169,11 +169,11 @@ func (r *MyRedis) SetJson(key string, value interface{}, t ...time.Duration) (st
|
||||
return r.Client.Set(ctx, key, v, t2).Result()
|
||||
}
|
||||
|
||||
func CloseInstance(key string) {
|
||||
func CloseDB(key string) {
|
||||
DB(key).Client.Close()
|
||||
}
|
||||
|
||||
func CloseAllInstance() {
|
||||
func CloseAllDB() {
|
||||
for _, v := range instanceMap {
|
||||
v.Client.Close()
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ func TestRedis(t *testing.T) {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
defer CloseAllInstance()
|
||||
defer CloseAllDB()
|
||||
|
||||
set, err := DB().Set(context.Background(), "name", "qwe123", time.Minute).Result()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user