mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-21 01:09:01 +08:00
getcache
This commit is contained in:
Vendored
+4
-1
@@ -10,6 +10,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||||
"github.com/dtm-labs/rockscache"
|
"github.com/dtm-labs/rockscache"
|
||||||
)
|
)
|
||||||
@@ -107,10 +108,12 @@ func getCache[T any](ctx context.Context, rcClient *rockscache.Client, key strin
|
|||||||
arr = append(arr, "first return")
|
arr = append(arr, "first return")
|
||||||
return t, nil
|
return t, nil
|
||||||
}
|
}
|
||||||
|
if v == "" {
|
||||||
|
return t, errs.ErrRecordNotFound
|
||||||
|
}
|
||||||
err = json.Unmarshal([]byte(v), &t)
|
err = json.Unmarshal([]byte(v), &t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
arr = append(arr, "json.Unmarshal error "+err.Error())
|
arr = append(arr, "json.Unmarshal error "+err.Error())
|
||||||
log.ZError(ctx, "cache json.Unmarshal failed", err, "key", key, "value", v, "expire", expire)
|
|
||||||
return t, utils.Wrap(err, "")
|
return t, utils.Wrap(err, "")
|
||||||
}
|
}
|
||||||
arr = append(arr, "success")
|
arr = append(arr, "success")
|
||||||
|
|||||||
Reference in New Issue
Block a user