(cacheName string, key string)
| 95 | } |
| 96 | |
| 97 | func GetKey(cacheName string, key string) (string, error) { |
| 98 | for i, name := range CacheNames { |
| 99 | if name == cacheName { |
| 100 | value, err := Caches[i].Get(key) |
| 101 | if err != nil { |
| 102 | // do not warn or log if key not found |
| 103 | if errors.Is(err, gcache.KeyNotFoundError) { |
| 104 | return "", nil |
| 105 | } |
| 106 | CacheConfig[i].Logger.Warningf("While getting key %s in cache %s: %s", key, cacheName, err) |
| 107 | |
| 108 | return "", err |
| 109 | } |
| 110 | |
| 111 | return value.(string), nil |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | log.Warningf("Cache %s not found", cacheName) |
| 116 | |
| 117 | return "", nil |
| 118 | } |
searching dependent graphs…