Two hours is a safe bet for Cave of the Winds.
About two hours, but it depends on the tour and the crowds. The standard Discovery Tour runs 45 minutes. You also wait for your tour time, buy tickets, and possibly stand in a line. Add another 30–45 minutes of waiting on a busy day, plus walking to and from the cave entrance.
If you do the longer Lantern Tour or the Haunted Tour, tack on another 30 minutes. Parking and walking the Rim Trail can eat time too.
Give yourself an extra hour if you want to wander the gift shop or grab a coffee.
