So can I say, if I cool the barrel after 5 or 10 shots and only use factory ammo it would help to extend the barrel life?
Assuming that the specific factory ammo you are using is not showing signs of pressure in your rifle and is not hot for your rifle/chamber, that is likely true. If you are cranking out those 10 shots as fast as possible each time, that could also be an issue.
An example for my statement:
Hornady factory loads can sometimes run hot in some rifles/chambers. Some people will experience signs of pressure, even blowing out primers. Others can use that ammo all day long with no signs of excess pressure. Pay attention to your case condition after firing and signs like hard bolt lift and tough extraction. These things are signs telling you what’s going on.
Knowing what a reasonable speed for your caliber, barrel, barrel length and load is supposed to be will help you to make good decisions regarding how and what ammo you run. For example, I like around 2750 FPS for 140 class bullets in my .260. It’s a medium speed load at best for the caliber. Others easily run 2850-2900 FPS and like that speed. This is from a 26” barrel. I could run mine hotter/faster, but I have been getting in excess of 3500 accurate rounds through a barrel, whereas those running hotter typically see only 2500-ish.
You can go really deep into the rabbit hole once you realize there are often ways to get more speed without extra pressure by using slower powders, optimized for your cartridge. But it’s not really necessary to get this deep into it to get decent life from a barrel.
And I won’t mention that sometimes a barrel just ain’t right and dies an early death.
In the end, it’s not bad to remember that if you shoot a lot, barrels are wear parts that will need to be replaced. If you don’t shoot a lot, you may never shoot out a barrel.