def METHOD_NAME(self, metric):
    if self.caching_metrics:
        if metric in self.included_metrics_cache:
            return True
        elif metric in self.excluded_metrics_cache:
            return False
    if self.config_included_metrics:
        METHOD_NAME = any(pattern.search(metric) for pattern in self.config_included_metrics)
        if self.config_excluded_metrics:
            METHOD_NAME = METHOD_NAME and not any(
                pattern.search(metric) for pattern in self.config_excluded_metrics
            )
        if self.caching_metrics and METHOD_NAME:
            self.included_metrics_cache.add(metric)
        return METHOD_NAME
    elif self.config_excluded_metrics:
        excluded_metrics = any(pattern.search(metric) for pattern in self.config_excluded_metrics)
        if self.caching_metrics and excluded_metrics:
            self.excluded_metrics_cache.add(metric)
        return not excluded_metrics
    else:
        return True