Shelf life for commercial canned foods can be determined by reading the expiration date located on the can's packaging. Canned goods bought at the grocery store are best when eaten within two to five years from the date of manufacture. Food quality gradually degrades after the date of expiration.
You should use unopened canned goods within two years of purchase as a rule of thumb, and store newly purchased cans behind older cans to ensure you're following the "first-in, first-out" rule. Canned foods that are high in acid need to be used quicker than foods with lower acid levels, because highly acidic foods have a shorter shelf life. For safety reasons always check cans for dents, bulges, leaks and rust, and discard cans that are badly damaged. Cans with broken seals must be discarded, because exposure to air badly damages the food inside. When in doubt about food quality you can open the can to check for deterioration, and if the food smells odd it is safer to discard it.
Never eat any canned food that smells funny or has a strange odor, because you might get sick. If the food looks and smells normal, you can taste a small sample, or boil the contents for at least 10 minutes, and then taste. Common canned food appearance defects include crystals, darkened color and soft texture.