app/code/community/Aoe/TemplateHints/Helper/BlockInfo.php
public function isWithinCachedBlock(Mage_Core_Block_Abstract $block) {
        $step = $block;
	$i = 0;
        while ($i++ < 20 && $step instanceof Mage_Core_Block_Abstract) {
            if (!is_null($step->getCacheLifetime())) {
                return true;
            }
            $step = $step->getParentBlock();
        }
        return false;
    }
public function isWithinCachedBlock(Mage_Core_Block_Abstract $block) {
        $step = $block;
	$i = 0;
        while ($i++ < 20 && $step instanceof Mage_Core_Block_Abstract) {
            if (!is_null($step->getCacheLifetime())) {
                return true;
            }
            $step = $step->getParentBlock();
        }
        return false;
    }
Check if a block is within another one that is cached

@param Mage_Core_Block_Abstract $block
@return bool
@author Fabrizio Branca
@since 2011-01-24