As Per Your question, You already know that you have a cavity plus your face has swollen up. What are you waiting for? There is no medicine that can only fix cavity, You have to undergo some treatments.
Next Steps
Please Visit the Dentist soon. It will Guide you taking some clinical Examinations along with Xray if Required.
Health Tips
You can apply Ice Pack over swollen area to get some relief.