Код для Magento 1.x
Mage::app()->getCacheInstance()->save($data, $key, $tags, $lifeTime);
Код для Magento 2
/**
* @param string $data
* @param string $key
* @param [] $tags [optional]
* @param int|null|false $lifeTime [optional]
* @return bool
*/
function df_cache_save($data, $key, $tags = [], $lifeTime = null) {
/** @var \Magento\Framework\ObjectManagerInterface $om */
$om = \Magento\Framework\App\ObjectManager::getInstance();
/** @var \Magento\Framework\App\CacheInterface $cache */
$cache = $om->get('Magento\Framework\App\CacheInterface');
return $cache->save($data, $key, $tags, $lifeTime);
}