Operating principle for a flip-flop memory cell based on erbium-doped devices is presented. A complete model for memory dynamics is introduced taking into account, at the same time, for memory writing, reading, and erasing. Simple equations are found relating writing, spontaneous and stimulated erasing times to device physical parameters, signals wavelength and power. In principle, for example, increasing writing and erasing energies at the appropriate wavelength it is possible to dramatically reduce transition times. Extinction ratio (ER) is also determined as a function of host medium, and signals properties. An optimization technique is proposed for erasing signal design in order to guarantee maximum ER. Numerical example are provided for Er and Er-Yb doped fibers whose doping ion density is rho = 1.1413middot1024 ions/m3, and 2.0 middot1025 ions/m3, respectively. Finally, an experimental demonstration giving an Er higher than 5 and 16 dB for the two fibers, respectively, is provided and discussed.