Scheme for decoherence control in microwave cavities