Memory B cells can provide long-term, sometimes lifelong, immunity, but the duration of their effectiveness can vary depending on the pathogen. For some diseases, like measles, memory B cells can offer protection for decades. For others, such as influenza, the immunity may wane over time due to the high mutation rates of the virus, necessitating periodic booster shots.