Cascading effect on second-harmonic generation in a ring cavity