touch wood in the 10 years I've been swimming regularly I haven't had any ear problems.

Not sure if this works, but seems to for me is to pull the cap all the way down past the ears.

This isn't part of the topic, but I've been swimming with a nose plug for the past few years. It took a while to get used to it, but I am a MUCH better swimmer for it, as I can stay under longer. Good thing I can't see (nor do I care) what I look like!