feat: redis.
This commit is contained in:
8
cache/redis/go.mod
vendored
8
cache/redis/go.mod
vendored
@@ -8,9 +8,9 @@ replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-kratos/kratos/v2 v2.8.4
|
github.com/go-kratos/kratos/v2 v2.8.4
|
||||||
github.com/redis/go-redis/extra/redisotel/v9 v9.9.0
|
github.com/redis/go-redis/extra/redisotel/v9 v9.10.0
|
||||||
github.com/redis/go-redis/v9 v9.9.0
|
github.com/redis/go-redis/v9 v9.10.0
|
||||||
github.com/tx7do/kratos-bootstrap/api v0.0.21
|
github.com/tx7do/kratos-bootstrap/api v0.0.23
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -18,7 +18,7 @@ require (
|
|||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||||
github.com/go-logr/logr v1.4.3 // indirect
|
github.com/go-logr/logr v1.4.3 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.9.0 // indirect
|
github.com/redis/go-redis/extra/rediscmd/v9 v9.10.0 // indirect
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||||
go.opentelemetry.io/otel v1.36.0 // indirect
|
go.opentelemetry.io/otel v1.36.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.36.0 // indirect
|
go.opentelemetry.io/otel/metric v1.36.0 // indirect
|
||||||
|
|||||||
12
cache/redis/go.sum
vendored
12
cache/redis/go.sum
vendored
@@ -19,12 +19,12 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
|||||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.9.0 h1:fhZTCKxHb3jlFYktf+ReLzEMrt58NHpmoZsky+8Xz3s=
|
github.com/redis/go-redis/extra/rediscmd/v9 v9.10.0 h1:uTiEyEyfLhkw678n6EulHVto8AkcXVr8zUcBJNZ0ark=
|
||||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.9.0/go.mod h1:UmKU2NxlGJSED8CBkZftTpwke0Tg144MKAu/d/r4L0I=
|
github.com/redis/go-redis/extra/rediscmd/v9 v9.10.0/go.mod h1:eFYL/99JvdLP4T9/3FZ5t2pClnv7mMskc+WstTcyVr4=
|
||||||
github.com/redis/go-redis/extra/redisotel/v9 v9.9.0 h1:trEhEKFu8qKSNl+7TRvUKcsoAEsPUsrO0HBf00mBSbg=
|
github.com/redis/go-redis/extra/redisotel/v9 v9.10.0 h1:4z7/hCJ9Jft8EBb2tDmK38p2WjyIEJ1ShhhwAhjOCps=
|
||||||
github.com/redis/go-redis/extra/redisotel/v9 v9.9.0/go.mod h1:gz3iYRb85Y8cXhuZKCvwZBH9rS+VS6ZCMItCRdMA+NU=
|
github.com/redis/go-redis/extra/redisotel/v9 v9.10.0/go.mod h1:B0thqLh4hB8MvvcUKSwyP5YiIcCCp8UrQ0cA9gEqyjk=
|
||||||
github.com/redis/go-redis/v9 v9.9.0 h1:URbPQ4xVQSQhZ27WMQVmZSo3uT3pL+4IdHVcYq2nVfM=
|
github.com/redis/go-redis/v9 v9.10.0 h1:FxwK3eV8p/CQa0Ch276C7u2d0eNC9kCmAYQ7mCXCzVs=
|
||||||
github.com/redis/go-redis/v9 v9.9.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
|
github.com/redis/go-redis/v9 v9.10.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||||
|
|||||||
12
cache/redis/redis.go
vendored
12
cache/redis/redis.go
vendored
@@ -10,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// NewClient create go-redis client
|
// NewClient create go-redis client
|
||||||
func NewClient(conf *conf.Data) (rdb *redis.Client) {
|
func NewClient(conf *conf.Data, logger *log.Helper) (rdb *redis.Client) {
|
||||||
if rdb = redis.NewClient(&redis.Options{
|
if rdb = redis.NewClient(&redis.Options{
|
||||||
Addr: conf.GetRedis().GetAddr(),
|
Addr: conf.GetRedis().GetAddr(),
|
||||||
Password: conf.GetRedis().GetPassword(),
|
Password: conf.GetRedis().GetPassword(),
|
||||||
@@ -19,23 +19,23 @@ func NewClient(conf *conf.Data) (rdb *redis.Client) {
|
|||||||
WriteTimeout: conf.GetRedis().GetWriteTimeout().AsDuration(),
|
WriteTimeout: conf.GetRedis().GetWriteTimeout().AsDuration(),
|
||||||
ReadTimeout: conf.GetRedis().GetReadTimeout().AsDuration(),
|
ReadTimeout: conf.GetRedis().GetReadTimeout().AsDuration(),
|
||||||
}); rdb == nil {
|
}); rdb == nil {
|
||||||
log.Fatalf("failed opening connection to redis")
|
logger.Fatalf("failed opening connection to redis")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// open tracing instrumentation.
|
// open tracing instrumentation.
|
||||||
if conf.GetRedis().GetEnableTracing() {
|
if conf.GetRedis().GetEnableTracing() {
|
||||||
if err := redisotel.InstrumentTracing(rdb); err != nil {
|
if err := redisotel.InstrumentTracing(rdb); err != nil {
|
||||||
log.Fatalf("failed open tracing: %s", err.Error())
|
logger.Fatalf("failed open tracing: %s", err.Error())
|
||||||
panic(err)
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// open metrics instrumentation.
|
// open metrics instrumentation.
|
||||||
if conf.GetRedis().GetEnableMetrics() {
|
if conf.GetRedis().GetEnableMetrics() {
|
||||||
if err := redisotel.InstrumentMetrics(rdb); err != nil {
|
if err := redisotel.InstrumentMetrics(rdb); err != nil {
|
||||||
log.Fatalf("failed open metrics: %s", err.Error())
|
logger.Fatalf("failed open metrics: %s", err.Error())
|
||||||
panic(err)
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
tag.bat
2
tag.bat
@@ -2,7 +2,7 @@ git tag api/v0.0.23 --force
|
|||||||
|
|
||||||
git tag utils/v0.1.4 --force
|
git tag utils/v0.1.4 --force
|
||||||
|
|
||||||
git tag cache/redis/v0.0.10 --force
|
git tag cache/redis/v0.0.11 --force
|
||||||
git tag oss/minio/v0.0.10 --force
|
git tag oss/minio/v0.0.10 --force
|
||||||
git tag logger/v0.0.10 --force
|
git tag logger/v0.0.10 --force
|
||||||
git tag rpc/v0.0.14 --force
|
git tag rpc/v0.0.14 --force
|
||||||
|
|||||||
Reference in New Issue
Block a user