Control of atomic state decay in cavities and microspheres