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

Method validateCache

internal/repository/cache/local.go:85–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83}
84
85func (r *rankingLocalCache) validateCache() error {
86 if len(r.posts) == 0 {
87 r.logger.Warn("本地缓存为空")
88 return ErrCacheEmpty
89 }
90
91 if time.Now().After(r.expireAt) {
92 r.logger.Warn("本地缓存已过期",
93 zap.Time("expire_at", r.expireAt))
94 return ErrCacheExpired
95 }
96
97 return nil
98}
99
100func (r *rankingLocalCache) copyPosts() []domain.Post {
101 result := make([]domain.Post, len(r.posts))

Callers 1

GetMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected