Answer:
If you've been vaccinated against the infection, eg. Tetanus, or flu vaccine, etc, you have what's called "acquired immunity". This means that when you were vaccinated with what is actaully a weaker version of the bacteria, your B-cells recognize them and produce antibodies, your T-cells then attacking and killing the antigens. Meaning that the next time your body is attacked, the B-cells will immediately recognize them and know how to respond because of it's memory.