MCPcopy Create free account
hub / github.com/appleboy/CodeGPT / needsRefresh

Function needsRefresh

util/api_key_helper.go:73–85  ·  view source on GitHub ↗

needsRefresh checks if the cached key needs to be refreshed

(cache *apiKeyCache, refreshInterval time.Duration)

Source from the content-addressed store, hash-verified

71
72// needsRefresh checks if the cached key needs to be refreshed
73func 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.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected