...
Cramps are a funny one, I suffered badly enough at one time I visited the GP and had a course of Quinine, but the GP was non committal about the exact cause. ...
I once heard that calcium carbonate antacid tablets (in USA, Tums is a common brand) is good to reduce likelihood of cramps. But I have never had a cramps problem while riding, so I am only relying what I heard from one source.
My cramps are more likely to be hours after a ride.