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

Method SetEmpty

internal/repository/cache/post.go:110–117  ·  view source on GitHub ↗

SetEmpty 缓存空对象,使用较短的过期时间

(ctx context.Context, key string)

Source from the content-addressed store, hash-verified

108
109// SetEmpty 缓存空对象,使用较短的过期时间
110func (c *postCache) SetEmpty(ctx context.Context, key string) error {
111 if key == "" {
112 return fmt.Errorf("无效的帖子ID: %s", key)
113 }
114
115 // 空对象使用空字符串标记,不需要存储完整结构
116 return c.client.Set(ctx, c.emptyKey(key), "1", time.Minute*5).Err()
117}
118
119// IsEmpty 检查是否存在空对象标记
120func (c *postCache) IsEmpty(ctx context.Context, key string) (bool, error) {

Callers

nothing calls this directly

Calls 2

emptyKeyMethod · 0.95
SetMethod · 0.65

Tested by

no test coverage detected