A study shows that drinking two glasses of cranberry juice a day, and spacing them about eight hours apart, may help to prevent the pain, itching and burning of urinary tract infections.

According to a study published in 2010 in Seminars in Arthritis and Rheumatism, people with rheumatoid and other forms of autoimmune arthritis are at higher risk of urinary tract infections compared to the general population, particularly if they also take medications like corticosteroids or disease-modifying anti-rheumatic drugs which decrease the body’s natural defenses against germs.

Though cranberries have been used for centuries by traditional healers to keep the urinary tract healthy, the new study, which was presented at the annual meeting of the American Chemical Society in Boston, has shed light on how this remedy may work.

“There are compounds in cranberry juice that prevent bacteria, which are mainly E. coli, from being able to attach to the urinary tract,” says study author Terri Anne Camesano, PhD, a professor of chemical engineering at Worcester Polytechnic Institute in Massachusetts.

That protective effect can take place in as little as eight hours after you drink a glass of the juice.

“Sometime between eight and 24 hours the effect starts to taper off, So what I would suggest at this point is that somebody should try to drink cranberry juice twice a day or at least every day,” Camesano says.

Researchers suggest that people consume 16 ounces, or two full juice glasses, daily to get the best protective effect. And look for cranberry drinks that contain at least 27 percent juice.

“We haven’t tested higher amounts because we wanted this to be the most accessible thing as possible for people,” Camesano explains. “Everybody can go to the store and buy cranberry juice cocktail, but not everyone wants to buy 100 percent juice and some may not like it.”

The protective effect of the cranberry juice isn’t related to the sugar, so you can opt for a diet or light form of the cocktail, as long as it still has at least 27 percent juice.

“Some of the diet products may not have that much juice in them, so that’s why people have to read the label and find out if there’s enough juice in it,” Camesano says.

If you’d rather eat real cranberries, the researchers say that one and a half ounces is equivalent to the 16 ounces of juice used in the study. Cranberry supplements are not recommended, the experts note, because it can be difficult to determine the cranberry content in them.