As a general rule, parts are not suitable for volume production after a few years. I forget the exact length of time and there are no hard and fast rules either. The main reason for this is due to solder-ability (the finish on the pins/pads gets messed up in ways that makes soldering less reliable). I want to say that the time is approximately 2 to 3 years, but like I said, no hard and fast rules. I'm sure if you kept parts for 5-10 years they would still function but you might have to do more rework when they are finally put onto a PCB.
Time is measured from date of manufacturer, not date of shipment.
For prototyping purposes, the time is much longer. I have parts that were stored in small plastic bins (on their original reels/tape) for 15+ years and have not had issues with using them.
Ceramic and Tantalum caps should have a longer shelf life than caps with a liquid electrolyte, like aluminum electrolytic caps because there is nothing inside to dry out. But I have 15+ year old Aluminum caps that work fine for prototyping.
Also, some parts need to be stored in a low-humidity environment and/or baked before being soldered down. This mostly applies to some chips, some diodes, and some MOSFETs.
Each part manufacturer should have documentation on storage conditions, and shelf life. If shelf life is important, then it is in your best interest to contact the mfg and get that documentation.