If I remember correctly, at Pharsalus, Caesar had heavy cavalry opposition from the Republicans, under his old cavalry commander Titus Labienus.

He allowed them to get round behind him, where they expected to run amok. Caesar had planned for this, and had equipped his rear ranks with 10 foot long spears - and wiped the floor with them.