func (authProvider *ecrAuthProvider) getAuthConfigFromCache(key cacheKey) *types.AuthConfig {
	token, ok := authProvider.tokenCache.Get(key.String())
	if !ok {
		return nil
	}

	cachedToken, ok := token.(*ecrapi.AuthorizationData)
	if !ok {
		log.Warnf("Reading ECR credentials from cache failed")
		return nil
	}

	if authProvider.IsTokenValid(cachedToken) {
		auth, err := extractToken(cachedToken)
		if err != nil {
			log.Errorf("Extract docker auth from cache failed, err: %v", err)
			// Remove invalid token from cache
			authProvider.tokenCache.Delete(key.String())
			return nil
		}
		return &auth
	} else {
		// Remove invalid token from cache
		authProvider.tokenCache.Delete(key.String())
	}
	return nil
}
func (authProvider *ecrAuthProvider) getAuthConfigFromCache(key cacheKey) *types.AuthConfig {
	token, ok := authProvider.tokenCache.Get(key.String())
	if !ok {
		return nil
	}

	cachedToken, ok := token.(*ecrapi.AuthorizationData)
	if !ok {
		log.Warnf("Reading ECR credentials from cache failed")
		return nil
	}

	if authProvider.IsTokenValid(cachedToken) {
		auth, err := extractToken(cachedToken)
		if err != nil {
			log.Errorf("Extract docker auth from cache failed, err: %v", err)
			
			authProvider.tokenCache.Delete(key.String())
			return nil
		}
		return &auth
	} else {
		
		authProvider.tokenCache.Delete(key.String())
	}
	return nil
}
func ( authProvider * ecrAuthProvider ) getAuthConfigFromCache ( key cacheKey ) * types . AuthConfig { token , ok := authProvider . tokenCache . Get ( key . String ( ) ) if ! ok { return nil } cachedToken , ok := token . ( * ecrapi . AuthorizationData ) if ! ok { log . Warnf ( " " ) return nil } if authProvider . IsTokenValid ( cachedToken ) { auth , err := extractToken ( cachedToken ) if err != nil { log . Errorf ( " " , err ) // Remove invalid token from cache authProvider . tokenCache . Delete ( key . String ( ) ) return nil } return & auth } else { // Remove invalid token from cache authProvider . tokenCache . Delete ( key . String ( ) ) } return nil }
// getAuthconfigFromCache retrieves the token from cache
getAuthconfigFromCache retrieves the token from cache