Flexible cation-based threshold selector for resistive switching memory integration