|
@@ -4,13 +4,13 @@ import (
|
|
|
"context"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
- "log"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
|
|
|
red "github.com/go-redis/redis/v8"
|
|
|
"github.com/zeromicro/go-zero/core/breaker"
|
|
|
"github.com/zeromicro/go-zero/core/errorx"
|
|
|
+ "github.com/zeromicro/go-zero/core/logx"
|
|
|
"github.com/zeromicro/go-zero/core/mapping"
|
|
|
"github.com/zeromicro/go-zero/core/syncx"
|
|
|
)
|
|
@@ -91,22 +91,19 @@ type (
|
|
|
Script = red.Script
|
|
|
)
|
|
|
|
|
|
-// New returns a Redis with given options.
|
|
|
-// Deprecated: use MustNewRedis or NewRedis instead.
|
|
|
-func New(addr string, opts ...Option) *Redis {
|
|
|
- return newRedis(addr, opts...)
|
|
|
-}
|
|
|
-
|
|
|
// MustNewRedis returns a Redis with given options.
|
|
|
func MustNewRedis(conf RedisConf, opts ...Option) *Redis {
|
|
|
rds, err := NewRedis(conf, opts...)
|
|
|
- if err != nil {
|
|
|
- log.Fatal(err)
|
|
|
- }
|
|
|
-
|
|
|
+ logx.Must(err)
|
|
|
return rds
|
|
|
}
|
|
|
|
|
|
+// New returns a Redis with given options.
|
|
|
+// Deprecated: use MustNewRedis or NewRedis instead.
|
|
|
+func New(addr string, opts ...Option) *Redis {
|
|
|
+ return newRedis(addr, opts...)
|
|
|
+}
|
|
|
+
|
|
|
// NewRedis returns a Redis with given options.
|
|
|
func NewRedis(conf RedisConf, opts ...Option) (*Redis, error) {
|
|
|
if err := conf.Validate(); err != nil {
|