Skip to content

Commit

Permalink
Merge pull request #102 from ArtisanCloud/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Matrix-X authored Jan 29, 2024
2 parents 8483b56 + 7f8da82 commit 6560221
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cache/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import (
"encoding/json"
"errors"
"fmt"
"time"

fmt2 "github.com/ArtisanCloud/PowerLibs/v3/fmt"
"github.com/ArtisanCloud/PowerLibs/v3/object"
"github.com/redis/go-redis/v9"
"time"
)

type GRedis struct {
Pool *redis.Client
Pool redis.UniversalClient
defaultExpiration time.Duration
lockRetries int
}
Expand Down Expand Up @@ -44,9 +45,9 @@ var CTXRedis = context.Background()

const lockRetries = 5

func NewGRedis(opts *redis.Options) (gr *GRedis) {
func NewGRedis(opts *redis.UniversalOptions) (gr *GRedis) {

c := redis.NewClient(opts)
c := redis.NewUniversalClient(opts)
gr = &GRedis{
Pool: c,
lockRetries: lockRetries,
Expand Down Expand Up @@ -102,8 +103,8 @@ func (gr *GRedis) SetEx(key string, value interface{}, expires time.Duration) er
//fmt.Printf("result:%s \r\n",cmd.String())
//fmt.Printf("err:%s \r\n", cmd.Err())

connPool := gr.Pool.Conn()
cmd := connPool.SetEx(CTXRedis, key, mValue, expires)
// connPool := gr.Pool.Conn()
cmd := gr.Pool.SetEx(CTXRedis, key, mValue, expires)
//fmt2.Dump(connPool.Pipeline())
//fmt.Printf("result:", cmd.String())

Expand Down

0 comments on commit 6560221

Please sign in to comment.