Retrieval-Augmented Defense: Adaptive and Controllable Jailbreak Prevention for Large Language Models