(cache *lru.Cache, key string, value any)
| 54 | } |
| 55 | |
| 56 | func get(cache *lru.Cache, key string, value any) (bool, error) { |
| 57 | if cachedJSON, ok := cache.Get(key); !ok { |
| 58 | return false, nil |
| 59 | } else if err := json.Unmarshal(cachedJSON.([]byte), &value); err != nil { |
| 60 | return false, fmt.Errorf("error unmarshalling cached entry: %w", err) |
| 61 | } else { |
| 62 | return true, nil |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | func set(cache *lru.Cache, key string, value any) (int, bool, error) { |
| 67 | if cachedJSON, err := json.Marshal(value); err != nil { |
no test coverage detected