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

Method GetCountCache

internal/repository/cache/relation.go:61–70  ·  view source on GitHub ↗
(ctx context.Context, key string)

Source from the content-addressed store, hash-verified

59}
60
61func (c *relationCache) GetCountCache(ctx context.Context, key string) (int64, error) {
62 count, err := c.client.Get(ctx, key).Int64()
63 if errors.Is(err, redis.Nil) {
64 return 0, nil // 缓存未命中
65 } else if err != nil {
66 return 0, err // Redis调用失败
67 }
68
69 return count, nil
70}
71
72func (c *relationCache) SetCountCache(ctx context.Context, key string, count int64, ttl time.Duration) error {
73 // 设置计数缓存并设置过期时间

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected