A Flexible Memristor Model With Electronic Resistive Switching Memory Behavior and Its Application in Spiking Neural