class DetectorMapper {

    public void detectorMappingCacheSync(long currentTime) {
        long updateDurationInSeconds = (currentTime - syncedUpTillTime) / 1000;
        if (updateDurationInSeconds <= 0) {
            return;
        }

        List<DetectorMapping> detectorMappings = detectorSource.findUpdatedDetectorMappings(updateDurationInSeconds);

        List<DetectorMapping> disabledDetectorMappings = detectorMappings.stream()
                .filter(dt -> !dt.isEnabled())
                .collect(Collectors.toList());
        if (!disabledDetectorMappings.isEmpty()) {
            cache.removeDisabledDetectorMappings(disabledDetectorMappings);
            log.info("Removing disabled mapping: {}", disabledDetectorMappings);
        }

        List<DetectorMapping> newDetectorMappings = detectorMappings.stream()
                .filter(DetectorMapping::isEnabled)
                .collect(Collectors.toList());
        if (!newDetectorMappings.isEmpty()) {
            cache.invalidateMetricsWithOldDetectorMappings(newDetectorMappings);
            log.info("Invalidating metrics for modified mappings: {}", newDetectorMappings);
        }

        syncedUpTillTime = currentTime;
    }

    public  DetectorMapper(DetectorSource detectorSource, DetectorMapperCache cache, int detectorCacheUpdateTimePeriod);
    public  DetectorMapper(DetectorSource detectorSource, Config config, MetricRegistry metricRegistry);

}