The time a refrigerator will stay cold when power is lost depends on the brand and how good the seals keep the cold inside. Time can vary from 2-6 hours without opening the doors. Without any power you can think of your refrigerator as a large picnic cooler. Placing blocks of ice inside will help to keep the temperature cool. Food in the freezer will last longer, especially if the freezer is more than half full. You need to be aware of how long the power has been out. Foods that start to get warm (above 40 degrees) may not look or smell bad but are starting to get bacteria that could make you sick. If the temperature gets above 40 degrees for more than an hour throw the food away. If the food in the freezer still has ice crystals it is probably fine for refreezing, if you don’t see ice crystals and it hasn’t reached 40 degrees you should treat the food as if it had been thawed in the refrigerator and prepare it or use it accordingly.
Food that spoils in the refrigerator can leave bad smells that won’t go away. The odors penetrate to the insulation where you can’t clean. It’s best if your power is going to be out longer than the appliance can keep the food cold, throw out the food before it spoils and ruins the appliance. You may have insurance coverage that will replace the food or the appliance, but what do you do while waiting for your insurance company? Keeping a small portable generator available can help prevent food waste and save your appliance. If you spend long periods away from your home then an automatic standby generator may be a better solution.