provider/dyn.go
func (d *dynProviderState) Records() ([]*endpoint.Endpoint, error) {
	client, err := d.login()
	if err != nil {
		return nil, err
	}
	defer client.Logout()

	log.Debugf("Using DynAPI@%s", d.DynVersion)

	var result []*endpoint.Endpoint

	zones := d.zones(client)
	log.Infof("Configured zones: %+v", zones)
	for _, zone := range zones {
		serial, err := d.fetchZoneSerial(client, zone)
		if err != nil {
			if strings.Index(err.Error(), "404 Not Found") >= 0 {
				log.Infof("Ignore zone %s as it does not exist", zone)
				continue
			}

			return nil, err
		}

		relevantRecords := d.ZoneSnapshot.GetRecordsForSerial(zone, serial)
		if relevantRecords != nil {
			log.Infof("Using %d cached records for zone %s@%d", len(relevantRecords), zone, serial)
			result = append(result, relevantRecords...)
			continue
		}

		//Fetch All Records
		records, err := d.fetchAllRecordsInZone(zone)
		if err != nil {
			return nil, err
		}
		relevantRecords = d.allRecordsToEndpoints(records)

		log.Debugf("Relevant records %+v", relevantRecords)

		d.ZoneSnapshot.StoreRecordsForSerial(zone, serial, relevantRecords)
		log.Infof("Stored %d records for %s@%d", len(relevantRecords), zone, serial)
		result = append(result, relevantRecords...)
	}

	return result, nil
}
func (d *dynProviderState) Records() ([]*endpoint.Endpoint, error) {
	client, err := d.login()
	if err != nil {
		return nil, err
	}
	defer client.Logout()

	log.Debugf("Using DynAPI@%s", d.DynVersion)

	var result []*endpoint.Endpoint

	zones := d.zones(client)
	log.Infof("Configured zones: %+v", zones)
	for _, zone := range zones {
		serial, err := d.fetchZoneSerial(client, zone)
		if err != nil {
			if strings.Index(err.Error(), "404 Not Found") >= 0 {
				log.Infof("Ignore zone %s as it does not exist", zone)
				continue
			}

			return nil, err
		}

		relevantRecords := d.ZoneSnapshot.GetRecordsForSerial(zone, serial)
		if relevantRecords != nil {
			log.Infof("Using %d cached records for zone %s@%d", len(relevantRecords), zone, serial)
			result = append(result, relevantRecords...)
			continue
		}

		//Fetch All Records
		records, err := d.fetchAllRecordsInZone(zone)
		if err != nil {
			return nil, err
		}
		relevantRecords = d.allRecordsToEndpoints(records)

		log.Debugf("Relevant records %+v", relevantRecords)

		d.ZoneSnapshot.StoreRecordsForSerial(zone, serial, relevantRecords)
		log.Infof("Stored %d records for %s@%d", len(relevantRecords), zone, serial)
		result = append(result, relevantRecords...)
	}

	return result, nil
}
// Records makes on average C + 2*Z  requests (Z = number of zones): 1 login + 1 fetchAllRecords
// A cache is used to avoid querying for every single record found. C is proportional to the number
// of expired/changed records