Actually in young women your age, having a few bladder infections is relatively normal. Women get bladder infections much more commonly than men mostly because the distance from the bladder to the outside is so short, allowing bacteria to get in much more easily. If you are just have 1 or 2 bladder infections per year, that is probably not a sign of a serious problem.
However there are some things you can do to help prevent bladder infections. First, wear absorbent light underwear. Second drink lots of fluids to keep the bladder flushed out. Third, observe good hygiene when using the toilet (always wipe front to back). Finally, make sure to urinate right after having sexual intercourse. With these simple measure, most routine urinary tract infections can be avoided.
Coffee doesn't really place a role in urinary tract infections, so I would worry
about that. In another related condition called interstitial cystitis (bladder infection like pain but without infection), coffee is sometimes an aggravating agent, but it doesn't sound to me like that is what is going on with you.
Talk to your primary care doctor
or your OB GYN doctor for more information about how this issue affects you.