The shelf life of an item depends on what food it is obviously, usually once an item is opened it should be eaten or refrigerated. Many products have an expiry date marked on it but I would still smell it to make sure it is okay to use. I usually don`t purchase things that are not marked with an expiry date, I also always check the expiry dates on the items before I purchase them and I don`t buy anything that is close to expiring.
I wouldn’t keep any food item for too long no matter what the expiry date, I don’t want to eat something that has been in the pantry for two years even if it isn’t passed the expiry date but that’s just my personal preference.
Many canned foods can stay in the pantry for a long time but one thing that worries me is why they are able to keep for so long. Naturally all food rots so it makes me a bit concerned what types of chemicals they are putting in the preserving liquids and cans in order to make the foods last so long, it seems a bit un natural to me.