needsRefresh checks if the cached key needs to be refreshed
(cache *apiKeyCache, refreshInterval time.Duration)
| 71 | |
| 72 | // needsRefresh checks if the cached key needs to be refreshed |
| 73 | func needsRefresh(cache *apiKeyCache, refreshInterval time.Duration) bool { |
| 74 | if cache == nil { |
| 75 | return true |
| 76 | } |
| 77 | |
| 78 | // Always refresh if interval is 0 |
| 79 | if refreshInterval == 0 { |
| 80 | return true |
| 81 | } |
| 82 | |
| 83 | // Check if cache is expired |
| 84 | return time.Since(cache.LastFetchTime) >= refreshInterval |
| 85 | } |
| 86 | |
| 87 | // GetAPIKeyFromHelper executes a shell command to dynamically generate an API key. |
| 88 | // Platform-specific implementations are in api_key_helper_unix.go and api_key_helper_windows.go. |
no outgoing calls
no test coverage detected