The first thing I want to make clear is that, the B and T that "will only float around in circulation for a short period of time before dying and being replaced", are not the ones that have already learned to recognise a certain diseases (or vaccine) but rather the naive cells that haven't yet done so. This is also made clear later in the same answer you cited:
As these injected protein sequences circulate through your blood they will eventually bump into a B or T cell that has a receptor that recognizes them. When this happens, the B or T cell will now start to divide and give rise to long lasting memory cells that express the exact same receptor and will therefore recognize the exact same protein sequence again in the future. These cells will float around in your blood for most of your life and make you 'immune' to the recognized pathogen.
In order to understand why some vaccines hold for your whole life, while some need a booster every few years we need to look at the life time or recycling of those memory cells, which stay in your body for much longer than the naive immune cells.
Now we come to the actual answer(s) to your question and there multiple factors that (can) have an influence on this:
* Initial strength of the immune response: Every vaccine (and/or disease) evokes an immune response with a different strength. 860
Generally the stronger the first response is, the more memory cells will be created initially (those actually don't have correspond to the same molecular memory either, they might recognise different aspects of the vaccine/disease) and with more cells available it will take longer until none are left
* Natural exposure: memory cells start proliferating when they encounter the molecule (protein/virus/bacteria) which they have 'memorised', if there is an acute infection they will do so a lot in order to produce a lot of antibodies against it. However, even a very small amount of virus/bacteria, that wouldn't actually make you sick, will allow induce them to proliferate and preserve their numbers. Therefore memory cells against a more common or prevalent disease should be more stable in your body, than ones against a very rare one.
* There very likely more factors that either I or the whole scientific community don't really know about. Cellular systems and the immune system in generally are rather complicated ... 225