refactor: remove Gorse integration and implement HotRank feature
- Removed Gorse-related configurations, handlers, and dependencies from the codebase. - Introduced HotRank feature with configuration options for ranking posts based on recent activity. - Updated application structure to support HotRank processing, including new caching mechanisms and database interactions. - Cleaned up related DTOs and repository methods to reflect the removal of Gorse and the addition of HotRank functionality.
This commit is contained in:
16
internal/cache/layered_cache.go
vendored
16
internal/cache/layered_cache.go
vendored
@@ -7,6 +7,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
redislib "github.com/redis/go-redis/v9"
|
||||
"go.uber.org/zap"
|
||||
|
||||
redisPkg "carrot_bbs/internal/pkg/redis"
|
||||
@@ -294,6 +295,21 @@ func (c *LayeredCache) ZRevRangeByScore(ctx context.Context, key string, max, mi
|
||||
return c.redis.ZRevRangeByScore(ctx, key, max, min, offset, count)
|
||||
}
|
||||
|
||||
func (c *LayeredCache) ZRevRange(ctx context.Context, key string, start, stop int64) ([]string, error) {
|
||||
if !c.enabled || c.redis == nil {
|
||||
return nil, ErrKeyNotFound
|
||||
}
|
||||
return c.redis.ZRevRange(ctx, key, start, stop)
|
||||
}
|
||||
|
||||
func (c *LayeredCache) ZReplaceSortedSet(ctx context.Context, key string, members []redislib.Z) error {
|
||||
if !c.enabled || c.redis == nil {
|
||||
return ErrKeyNotFound
|
||||
}
|
||||
c.local.Delete(key)
|
||||
return c.redis.ZReplaceSortedSet(ctx, key, members)
|
||||
}
|
||||
|
||||
func (c *LayeredCache) ZRem(ctx context.Context, key string, members ...any) error {
|
||||
if !c.enabled || c.redis == nil {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user