Nanosecond resistive switching in memristors