If you can afford it, a UPS is a good investment. The unit should last a lifetime. The batteries for 3 years or so.
Prior to buying mine I lost a couple of computers to bouncing mains. Since then, no damaged computers, kit (computers, switches, firewall, modem) remains unaffected by the 5 second outages sometimes affecting this area and controlled automatic shutdown for longer outages.