If you want to keep it, don't set it by default instead give an option to the user asking if they want to add cache control to the sitemaps or not. Moreover adding this cache-control via PHP prevents users to overwrite it via server rule like nginx.conf
as Nginx will add the header first and then PHP will overwrite it.
protected function send_headers( $headers = [] ) {
$expires = gmdate( 'D, d M Y H:i:s', ( time() + YEAR_IN_SECONDS ) );
$defaults = [
'X-Robots-Tag' => 'noindex',
'Content-Type' => 'text/xml; charset=' . $this->get_output_charset(),
'Pragma' => 'public',
'Cache-Control' => 'maxage=' . YEAR_IN_SECONDS, // <-- THIS LINE
'Expires' => $expires . ' GMT',
'Etag' => md5( $expires . $this->type ),
];
$headers = wp_parse_args( $headers, $defaults );
header( $this->get_protocol() . ' 200 OK', true, 200 );
foreach ( $headers as $header => $value ) {
header( $header . ': ' . $value );
}
}
Please stop adding cache-control by default. The plugin should never add the cache-control and if any user needs they can add the respective htaccess or nginx rules for that in the server.