This recently released feature allows query results using JS UDFs to be cached. See https://issuetracker.google.com/issues/138310623