MCPcopy Create free account
hub / github.com/go-dev-frame/sponge / SetCacheWithNotFound

Method SetCacheWithNotFound

pkg/cache/redis.go:195–202  ·  view source on GitHub ↗

SetCacheWithNotFound set value for notfound

(ctx context.Context, key string)

Source from the content-addressed store, hash-verified

193
194// SetCacheWithNotFound set value for notfound
195func (c *redisCache) SetCacheWithNotFound(ctx context.Context, key string) error {
196 cacheKey, err := BuildCacheKey(c.KeyPrefix, key)
197 if err != nil {
198 return fmt.Errorf("BuildCacheKey error: %v, key=%s", err, key)
199 }
200
201 return c.client.Set(ctx, cacheKey, NotFoundPlaceholder, DefaultNotFoundExpireTime).Err()
202}
203
204// BuildCacheKey construct a cache key with a prefix
205func BuildCacheKey(keyPrefix string, key string) (string, error) {

Callers

nothing calls this directly

Calls 4

BuildCacheKeyFunction · 0.85
ErrorfMethod · 0.80
SetMethod · 0.65
ErrMethod · 0.45

Tested by

no test coverage detected