feat(hot-rank): add per-channel hot ranking functionality
Add channel-specific hot post filtering and ranking across the posts listing flow. Introduce refreshChannelRanks to compute per-channel hot scores, new Redis cache keys for channel hot ranks, and update repository/service/handler layers to accept channelID filtering parameters. Update HotRankWorker dependency injection to include ChannelRepository.
This commit is contained in:
8
internal/cache/keys.go
vendored
8
internal/cache/keys.go
vendored
@@ -57,6 +57,14 @@ func HotRankTopIDsKey() string {
|
||||
return HotRankTopIDs
|
||||
}
|
||||
|
||||
func HotRankZSetChannelKey(channelID string) string {
|
||||
return fmt.Sprintf("%s:ch:%s", HotRankZSet, channelID)
|
||||
}
|
||||
|
||||
func HotRankTopIDsChannelKey(channelID string) string {
|
||||
return fmt.Sprintf("%s:ch:%s", HotRankTopIDs, channelID)
|
||||
}
|
||||
|
||||
func PostListKey(postType string, userID string, page, pageSize int) string {
|
||||
if userID == "" {
|
||||
return fmt.Sprintf("%s:%s:%d:%d", PrefixPostList, postType, page, pageSize)
|
||||
|
||||
Reference in New Issue
Block a user