How to programmatically check whether a particular cache type is enabled

###Magento 1.x:

Mage::app()->getCacheInstance()->canUse($type)

###Magento 2:

An example from the core:

A sample detection code:

/** @var \Magento\Framework\App\ObjectManager $om */
$om = \Magento\Framework\App\ObjectManager::getInstance();
/** @return \Magento\Framework\App\Cache\StateInterface */
$cacheState = $om->get('Magento\Framework\App\Cache\StateInterface');
/** @var bool $isEnabled */
$isEnabled = $cacheState->isEnabled(
    \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER
);

The standard cache types: https://github.com/magento/magento2/tree/2.0.0/lib/internal/Magento/Framework/App/Cache/Type

See also: