Once you've been exposed to a virus, your body produces memory cells. These cells recognize the virus if you are exposed to it again and tell the immune system to produce antibodies to fight it. This idea is still being studied and may be rare. Memory cells usually can't block infection like neutralizing antibodies do, but they don't need to.
With COVID-19, infection occurs quickly, but it takes a little time to cause serious illness. This gives memory T cells time to do their job and when re-exposed to a virus or boost, these cells will rapidly proliferate. This may not be fast enough to prevent getting sick, but it could be fast enough to avoid hospitalization. To combat this, the body's immune system must destroy infected cells.
When the body first encounters a new viral infection, it deploys T cells which find and destroy infected cells. If the infection continues, the body deploys B cells which create antibodies that can better attack infected cells.