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

Method IsEmpty

internal/repository/cache/post.go:120–131  ·  view source on GitHub ↗

IsEmpty 检查是否存在空对象标记

(ctx context.Context, key string)

Source from the content-addressed store, hash-verified

118
119// IsEmpty 检查是否存在空对象标记
120func (c *postCache) IsEmpty(ctx context.Context, key string) (bool, error) {
121 if key == "" {
122 return false, fmt.Errorf("无效的帖子ID: %s", key)
123 }
124
125 exists, err := c.client.Exists(ctx, c.emptyKey(key)).Result()
126 if err != nil {
127 return false, err
128 }
129
130 return exists > 0, nil
131}
132
133// PreHeat 预热热点缓存,设置更长的过期时间
134func (c *postCache) PreHeat(ctx context.Context, posts []domain.Post) error {

Callers 2

GetMethod · 0.95
GetPubMethod · 0.95

Calls 1

emptyKeyMethod · 0.95

Tested by

no test coverage detected