We present a quantum memory protocol for photons that is based on the direct control of the transition dipole moment. We focus on the case where the light-matter interaction is enhanced by a cavity. We show that the optimal write process (maximizing the storage efficiency) is related to the optimal read process by a reversal of the effective time τ = dtg 2 (t)/κ, where g(t) is the timedependent coupling and κ is the cavity decay rate. We discuss the implementation of the protocol in a rare-earth ion doped crystal, where an optical transition can be turned on and off by switching a magnetic field.Quantum memories for light are devices that allow one to store and retrieve light in a way that preserves its quantum state [1][2][3]. They are essential components for optical quantum information processing, notably for quantum repeaters [4]. All quantum memories require a way of switching the coupling between the light and the material system (which is used as the memory) on and off in a controlled way. In the case of memories based on electromagnetically induced transparency or off-resonant Raman transitions [1,[5][6][7][8] the coupling is controlled by a laser beam, which is typically much more intense than the signal that one aims to store. In contrast, in the case of photon-echo based memories [3, 9, 10] the coupling is controlled in a more indirect way via the dephasing of the atoms in the storage medium. This typically requires spectral tailoring of the medium by optical pumping before the signal can be stored.Here we consider a way of controlling the light-matter interaction that is different from the mentioned examples, and that is particularly simple from a conceptual point of view, namely the direct control of the transition dipole element of the relevant optical transition. This is motivated by recent demonstrations that transition dipoles can be turned on and off in certain solid-state systems, in particular in rare-earth ion doped crystals by applying magnetic fields [11][12][13], and for NV centers in diamond by applying electric fields [14]. We consider the case where the storage medium is placed inside an optical cavity [15][16][17]. This both enhances the light-matter interaction, which is desirable for achieving high efficiencies, and simplifies the equations of motion, thus clearly bringing out the basic principles of the memory dynamics. The free-space case, which is attractive from the point of view of experimental implementation, is discussed in the appendix.We consider an ensemble of two-level atoms coupled to a cavity mode, see Fig. 1. We ignore the spatial dependence of the light-matter interaction, and thus phasematching considerations [18,19]. The system that we consider is formally equivalent to a Raman memory in a cavity, if the excited state is adiabatically eliminated in the Raman case [15], and where the two-photon spin transition is replaced by a single-photon optical transition. There is also some similarity to Refs. [20,21], where the light-matter coupling is controlled by tuning a ca...