コード例 #1
0
ファイル: AbstractTest.php プロジェクト: nemphys/magento2
 public function testGetCacheLifetime()
 {
     $this->assertNull($this->_block->getCacheLifetime());
     $this->_block->setCacheLifetime(1800);
     $this->assertEquals(1800, $this->_block->getCacheLifetime());
 }
コード例 #2
0
 /**
  * Get cache information of a block
  *
  * @param Mage_Core_Block_Abstract $block
  * @return string
  * @author Fabrizio Branca <*****@*****.**>
  * @since 2011-01-24
  */
 protected function getCacheInfo(Mage_Core_Block_Abstract $block)
 {
     $cacheLifeTime = $block->getCacheLifetime();
     $cacheInfo = '';
     if (!is_null($cacheLifeTime)) {
         $cacheLifeTime = intval($cacheLifeTime) == 0 ? 'forever' : intval($cacheLifeTime) . ' sec';
         $cacheInfo = 'Lifetime: ' . $cacheLifeTime . ', ';
         $cacheInfo .= 'Key:' . $block->getCacheKey() . ', ';
         $cacheInfo .= 'Tags: ' . implode(',', $block->getCacheTags()) . '';
     }
     return $cacheInfo;
 }