I get cramps via dehydration - at least I assume that's what it is, I get them in the early hours of the morning after I've seriously tied one on.
An ex of mine used to get them all the time, and he had big muscles, so that's a lot of hurt. The first time I had one in his company (during sex OF COURSE!) he was amazed that I didn't know how to relieve a cramp.
Work the muscle naturally.
So a foot cramp, flex the foot, a calf cramp, flex the calf etc. I was gutted that no-one had suggested it before. Of course it was kinda cute to have someone else manipulating my calf to show me what he meant
I get them less now because at the first hint I just gently start flexing.