How to Disable Caches programmatically in magento

Magento has an in built Caching System that improves the Performance of the website. But this feature should be turned off during Development and theme design to view our changes properly.

Sometimes we may come across a situation like our admin panel cannot be accessed due to some unfinished code or error. Even though we fixed the code magento may cache that error page and produce the same result. Even if we cleared the contents in the cache directory it will be filled again if the cache is enabled in admin. In Such cases we can programmatically disable and flush the cache.

The Below Code snippet disables the cache in code.

Compatability: Magneto 1.4 onwards