Neither real black powder or percussion caps have a 'shelf life'; they will last indefinitely. However, one is advised to keep them dry. They can be recovered but it takes some effort if they get wet.
Substitute black powders have been reported to degrade over time and are much harder to recover from wet conditions.
Keeping a black powder gun loaded over along period is not problematic, but considering that one should practice with the gun regularly to maintain proficiency it makes little sense from a practical standpoint.