If the cavity is small and hasn't gotten to deep then yes applying some clove oil to the tooth with the cavity can help heal up the cavity and prevent further infection.
The clove oil will also prevent further progression of the cavity as long as you continue to use mouthwash and brush your teeth often.
I've also healed up a cavity that was small using demic toothpaste which bonds to the tooth and fills in the cavity.
You can also kill bacteria in your mouth and prevent gum disease and future cavities by oil pulling with Coconut Oil and also by using Apple Cider Vinegar as a mouth wash.