feat(app): update

This commit is contained in:
Yangtao
2025-11-18 18:33:22 +08:00
parent 6e56cab848
commit 7c0ad28e96
27 changed files with 20 additions and 673 deletions

View File

@ -1,8 +1,8 @@
package cache
import (
"servicebase/pkg/log"
"errors"
"servicebase/pkg/log"
"time"
)
@ -10,7 +10,7 @@ func Lock(key string) (e error) {
var success bool
TryMax := 6
redisClient := GetCommonRedisInstance().RedisClient
for i := 0; i < TryMax; i++ {
for range TryMax {
success, e = redisClient.SetNX(Ctx(), key, time.Now(), time.Millisecond*1000*3).Result()
if e != nil {
log.Info("Lock GetCommonRedisInstance error: " + e.Error())
@ -46,7 +46,7 @@ func RedisLockGetTime(key string, duration time.Duration) (e error) {
func RedisLockGet(key string) (e error) {
redisClient := GetCommonRedisInstance().RedisClient
success := false
for i := 0; i < TryMax; i++ {
for range TryMax {
success, e = redisClient.SetNX(Ctx(), key, time.Now(), LockTimeout).Result()
if nil != e {
return