BuildCacheKey construct a cache key with a prefix
(keyPrefix string, key string)
| 203 | |
| 204 | // BuildCacheKey construct a cache key with a prefix |
| 205 | func 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 |
no outgoing calls