system
Given the following post, respond as if you're commenting on Reddit:
human
Where are vaccine "memories" stored?

If I understand correctly, vaccines work by exposing the immune system to a weakened, or even dead foreign body.  The immune system is trained to "recognize" this.

Where is this "memory" "stored"?

Forgive the quotes, but I know these words are likely not appropriate for the reality of the answer that is likely to come.  ;-)
gpt
These are not memories in the way you remember what you had for breakfast this morning. The way the immune system recognizes non-self particles (like bacteria) is by identifying particular components of protein on the surface of the foreign body, typically called an epitope. As a part of the immune response, your body identifies a foreign epitope and ramps up production of cells in the immune system to destroy them. These cells include T cells and B cells.

Most of these cells are shortlived, and do not stick around once the infection is eliminated. On the other hand, a small subset, called Memory T cells and Memory B cells, have much longer lifespans. 

One of the slowest steps in the process of fighting off an infection is recognition of an epitope common to most/all of the pathogen causing the problem, this is necessary in order to create cells that will target the infection. 

Memory T and Memory B Cells make that process MUCH MUCH quicker allowing for rapid creation of cytotoxic T (killer T cells) which kill a pathogen more directly and B cells or B Lymphocytes which create antibodies which recognize the specific epitope and "mop up" the bacteria so that they are clustered and can be ingested and destroyed by macrophages (macrophage is greek for "big eater", these cells eat up the bad stuff, essentially)

To directly answer your question / tl;dr vaccines expose your body to just enough of a potential pathogen to cause generation of the memory cells but not to get you sick. 

Fun fact: some pathogens, bacteria, but especially virii, change their epitope frequently. This is why last year's flu vaccine is not good this year. The flu vaccine is engineered against whatever happens to be the most common strain for that year.