style: 统一代码格式和行尾

This commit is contained in:
leonincs
2026-05-20 16:34:19 +08:00
parent 0b87fd94cc
commit 732e284369
68 changed files with 7784 additions and 7781 deletions

View File

@@ -1,28 +1,28 @@
package video
import (
"context"
"strconv"
"time"
rediscache "feedsystem_video_go/internal/middleware/redis"
)
// 更新视频流行度缓存
func UpdatePopularityCache(ctx context.Context, cache *rediscache.Client, id uint, change int64) {
if cache == nil || id == 0 || change == 0 {
return
}
_ = cache.Del(context.Background(), cache.Key("video:detail:id=%d", id))
now := time.Now().UTC().Truncate(time.Minute)
windowKey := cache.Key("hot:video:1m:%s", now.Format("200601021504"))
member := strconv.FormatUint(uint64(id), 10)
opCtx, cancel := context.WithTimeout(ctx, 50*time.Millisecond)
defer cancel()
_ = cache.ZincrBy(opCtx, windowKey, member, float64(change))
_ = cache.Expire(opCtx, windowKey, 2*time.Hour)
}
package video
import (
"context"
"strconv"
"time"
rediscache "feedsystem_video_go/internal/middleware/redis"
)
// 更新视频流行度缓存
func UpdatePopularityCache(ctx context.Context, cache *rediscache.Client, id uint, change int64) {
if cache == nil || id == 0 || change == 0 {
return
}
_ = cache.Del(context.Background(), cache.Key("video:detail:id=%d", id))
now := time.Now().UTC().Truncate(time.Minute)
windowKey := cache.Key("hot:video:1m:%s", now.Format("200601021504"))
member := strconv.FormatUint(uint64(id), 10)
opCtx, cancel := context.WithTimeout(ctx, 50*time.Millisecond)
defer cancel()
_ = cache.ZincrBy(opCtx, windowKey, member, float64(change))
_ = cache.Expire(opCtx, windowKey, 2*time.Hour)
}