I started rotating some canned/boxed items. I had moved more to a fresh fruits & veggies diet for a while, so I had some shelf items that were several years old.
I use a common sense approach:
= Make sure the can isn't damaged to allow air/bacteria in. That includes any rust or corrosion spots, which can happen in a humid environment.
= Make sure the can isn't bulging.
= When opened, smell it. If there is questionable odor or discoloration, dump it. Some foods are more susceptible to shorter shelf life.
For boxed items, dry pasta can probably last centuries, as long as it is kept from any humidity. Boxed products that contain ‘rising’ elements (yeast/baking powder) have a shorter shelf life.
I now use a marker to ‘date’ items so the ‘date’ is easily visible. I just mark 10, 11, 12, etc., for the year and shelve in year groups. That way, I can quickly glance to see which items may be getting near the expiration.
Because I live in a humid environment and because many boxed items have contents in paper, rather than plastic envelopes. Insects can bore through the paper into the product, so I put those items in plastic zip bags for storage. That keeps them humidity and bug free.
[Note: This does not always dissuade rodent creatures from chewing through, so if rodents are a problem, place the items in a protective container.]
RubberMade tubs are good for stockpiling.