The emerging optoelectronic resistive switching memory are more attractive owing to their ability to combine the advantages of both photonics and electronics. However, currently proposed optoelectronic resistive switching memory are light erasing/writing only or photo-induced modulated. In this research, we report the optoelectronic resistive switching memory composed of a simple ITO/NiO nanoparticles-apple pectin (AP NiO)/Al structure. Due to the detraping/retrapping of electrons within the AP NiO layer, which effectively modulates the band bending at the Al/AP NiO region, thus leading to persistent photoresponse in the present devices. The results of using electrical writing and UV light writing exhibited different current transmission mechanisms, clearly confirming the uniqueness of the light-writing behavior. In addition, light erasing can be achieved during green light irradiation with a wavelength. Results on the correlation of the light writing/erasing with the transmission mechanisms will also be explored. The transmission mechanisms are summarized as follows: Type I (filament only), Type II (trap-assisted tunneling and trap–detrap domain) and Type III (hybrid path). The measurements of CAFM are particularly useful for construction of the mechanical model. Exploiting the dependence of different mechanism on the light writing/erasing may enable new design space for future bio-electronic applications.