Resistive switching in Ag–TiO2 contacts