One can not escape from the fruit of any Karma be that good or bad neither by hiding in the cleft of a mountain or cave nor by worshiping the deities. A wise one is conscious of this Truth so does all good.
The solution of being freed from the Karma Cycle is nothing but The Supreme Enlightenment or The Realization of The Ultimate Principal of Reality and living accordingly. In single word the cause of cycle of karma is Attachment, the cause of Attachment is IGNORANCE OF THE TRUTH, I.E., EVERY THING IS IMPERMANENT, TRANSITORY, SUBJECT TO DECAY AND DEATH, SO NOT TO BE ATTACHED, LETTING GO OF ALL, REMAINING UNATTACHED LIKE LOTUS FLOWER; SELFLESS AND LIBERATED FROM ALL THE BONDS WHICH BIND ONE TO DREARY ROUND OF BIRTH AND DEATH, THAT IS NIRVANA.