When properly refrigerated, a bakery cake lasts 2-4 days past the "sell by" date, cake with fresh fruit lasts 1-2 days, cake with whipped cream lasts 1-2 days and fruit cake has a debatable shelf life. Bakery cakes and those with fresh fruit will stay good in a freezer for up to 4 months.
A cake that has gone bad can cause food borne illnesses, so it is important to check the cake before eating it. If the cake is hard or has a dry texture or if mold has developed on any part of the cake, it is time to throw it out. Additionally, fruit fillings turn slimy when they are no longer good. To help extend the shelf life, wrap the uneaten cake in plastic wrap to keep out air and other contaminants.