Some people I’ve talked just don’t know how long foods last. This is a problem as eating contaminated food and make you sick and even kill you.
The primary issue is temperature. The food industry calls the region between 40°F and 140°F the Danger Zone. The is the temperature region where bacteria can reproduce quickly enough to hurt you. Generally they can double their population in about 2 hours in this range.
Between 32°F and 40°F is refrigerator temperatures and food can last for weeks as bacteria have a much harder time reproducing here.
Below 32°F is freezer temperature and food can last for months. Temperatures below -40°F can actually kill the eggs of certain insects by having the ice crystals break through their cellular structure.
Milk and Meats will generally be safe for an hour in the Danger Zone. They are designed for being inside something so that makes sense. These things need to be refrigerated or frozen as soon as possible. Or you could preserve them in some way to make then shelf stable for months.
Eggs will last a few days and up to a week at room temperature, depending on how fresh they are.
Cheese is a hard one because it depends on the cheese.
Fruits and vegetables are designed for sitting at room temperature, obviously, and will last several days to a few weeks post harvest.
Canned goods will last at least a year and easily longer, though the nutritive value tends to drop after that. Canned foods include food in metal cans, glass jars and in retort pouches (you can see this in the supermarket with tuna, salmon and other fish, also MREs are made this way.) Avoid any cans that are dented and especially cans that are bulging, they are harboring a colony of botulism and as little as 12 molecules can kill you. Actually, you can survive a bout of botulism, its effects are to just paralyze all you muscles, which you can recover from in about 6 weeks, as long as you have a respirator to breathe for you and an IV to feed you.
Dried or dehydrated foods like beef jerky and raisins, can last a year or more depending on the humidity. There have been many different kinds of foods found in the tombs of Egypt that could be reconstituted and eaten. Whole grains are included in this group as well. Rice, wheat berries and barleycorns are dried and then they can last 30+ years. And don’t forget thing like powdered milk, that is dried as well.
Salt cured foods like country ham and sugar cured foods like candied ginger can last a few years as salt and sugar can both suck the water out of germ cells so they die.
Brined foods like traditional sauerkraut and kim chi will last for months because friendly bacteria will keep other bacteria out.
On the Other Hand
You can go to StillTasty and find out if its fine.