My Tilly is a martyr to cystitis. There's two basic causes (viral and non-viral) but both treated in the same way. Bacteria builds up in the bladder and inflammes things, then the urine attacks the weakened bladder lining and urethra. The knack is to adjust the chemical balance in urine and that eases the inflammation.
As has been said, sometimes an increase in water intake is enough for the bladder to settle back down. If it persists or gets severe a long acting antibiotic coupled with a treatment like Cystease will sort it.
There is a virus which can cause cystitis which you can test for. The test isn't pleasant as it involves sedation and puncturing the bladder to get a sample. Day surgery case. Not cheap. Also cystitis can caused by stress, and sometimes them not wanting to go outside to pee as often as usual so the urine gets more potent and damages the bladder lining.
In fact it's more or less exactly the same for humans... only you can't get a cat to drink Cranberry!