  We present a novel technique to minimize UV-induced damage in experiments
that employ second-harmonic generation cavities. The principle of our approach
is to reduce the duty cycle of the UV light as much as possible to prolong the
lifetime of the used optics. The low duty cycle is achieved by ramping the
cavity into resonance for a short time during the experimental cycle when the
light is used and tuning it to an off-resonant state otherwise. The necessary
fast ramp and length-stabilization control of the cavity is implemented with
the FPGA-based STEMlab platform. We demonstrate the utility of this method by
measuring the isotope shift of the electronic transition ($X^1\Sigma \leftarrow
A^1\Pi$) in AlCl at 261.5 nm in a pulsed molecular beam experiment.
