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

Function BuildCacheKey

pkg/cache/redis.go:205–216  ·  view source on GitHub ↗

BuildCacheKey construct a cache key with a prefix

(keyPrefix string, key string)

Source from the content-addressed store, hash-verified

203
204// BuildCacheKey construct a cache key with a prefix
205func BuildCacheKey(keyPrefix string, key string) (string, error) {
206 if key == "" {
207 return "", errors.New("[cache] key should not be empty")
208 }
209
210 cacheKey := key
211 if keyPrefix != "" {
212 cacheKey = strings.Join([]string{keyPrefix, key}, ":")
213 }
214
215 return cacheKey, nil
216}
217
218// -------------------------------------------------------------------------------------------
219

Callers 15

SetMethod · 0.85
GetMethod · 0.85
MultiSetMethod · 0.85
MultiGetMethod · 0.85
DelMethod · 0.85
SetCacheWithNotFoundMethod · 0.85
SetMethod · 0.85
GetMethod · 0.85
MultiSetMethod · 0.85
MultiGetMethod · 0.85
DelMethod · 0.85
SetCacheWithNotFoundMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestBuildCacheKeyFunction · 0.68