MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / ForceGet

Method ForceGet

internal/repository/cache/local.go:69–83  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

67}
68
69func (r *rankingLocalCache) ForceGet(ctx context.Context) ([]domain.Post, error) {
70 r.mu.RLock()
71 defer r.mu.RUnlock()
72
73 if len(r.posts) == 0 {
74 r.logger.Warn("强制获取:本地缓存为空")
75 return nil, ErrCacheEmpty
76 }
77
78 result := r.copyPosts()
79 r.logger.Debug("强制获取本地缓存成功",
80 zap.Int("post_count", len(result)),
81 zap.Time("expire_at", r.expireAt))
82 return result, nil
83}
84
85func (r *rankingLocalCache) validateCache() error {
86 if len(r.posts) == 0 {

Callers

nothing calls this directly

Calls 1

copyPostsMethod · 0.95

Tested by

no test coverage detected