Resistive switching memory (RSM) emerges as a decisive player for the future development of semiconductor industry due to its many advantages, such as high speed, cost effectiveness, excellent scalability, and compatibility with current technology. However, the electrical reading of the RSM array is usually in series sequence, which limits its maximum data storage density and processing speed. This drawback can be overcome by optically readable memory devices. Herein, we demonstrate an unprecedented optically and electrically controllable light-emitting RSM. This device uses a tandem structure which is composed of a light-emitting RSM and a perovskite solar cell. The state of the device can be encoded both electrically and optically, with highresistive state and low-resistive state. Interestingly, the device exhibits electroluminescence in the low-resistive state, which provides the capability for reading the encoded signal optically. By integrating with a solar cell, the whole device enables to assist on the lightemitting RSM to achieve the unique feature of optical writing. Compared with conventional memory, our designed device with multiple functionalities of optical/electrical encoding and electrical/optical reading should be very useful and timely for the development of next-generation information technology.