concrete/src/Block/Block.php
public function setBlockCachedOutput($content, $lifetime, $area)
    {
        $db = Loader::db();
        $c = $this->getBlockCollectionObject();

        $btCachedBlockOutputExpires = strtotime('+5 years');
        if ($lifetime > 0) {
            $btCachedBlockOutputExpires = time() + $lifetime;
        }

        $arHandle = $this->getAreaHandle();
        $cID = $c->getCollectionID();
        $cvID = $c->getVersionID();
        if ($this->isBlockInStack() && is_object($area)) {
            $arHandle = $area->getAreaHandle();
            $cx = Page::getCurrentPage();
            $cID = $cx->getCollectioniD();
            $cvID = $cx->getVersionID();
        }

        if ($arHandle && $cID && $cvID) {
            $db->Replace(
                'CollectionVersionBlocksOutputCache',
                [
                    'cID' => $cID,
                    'cvID' => $cvID,
                    'bID' => $this->getBlockID(),
                    'arHandle' => $arHandle,
                    'btCachedBlockOutput' => $content,
                    'btCachedBlockOutputExpires' => $btCachedBlockOutputExpires,
                ],
                [
                    'cID',
                    'cvID',
                    'arHandle',
                    'bID',
                ],
                true
                );
        }
    }
public function setBlockCachedOutput($content, $lifetime, $area)
    {
        $db = Loader::db();
        $c = $this->getBlockCollectionObject();

        $btCachedBlockOutputExpires = strtotime('+5 years');
        if ($lifetime > 0) {
            $btCachedBlockOutputExpires = time() + $lifetime;
        }

        $arHandle = $this->getAreaHandle();
        $cID = $c->getCollectionID();
        $cvID = $c->getVersionID();
        if ($this->isBlockInStack() && is_object($area)) {
            $arHandle = $area->getAreaHandle();
            $cx = Page::getCurrentPage();
            $cID = $cx->getCollectioniD();
            $cvID = $cx->getVersionID();
        }

        if ($arHandle && $cID && $cvID) {
            $db->Replace(
                'CollectionVersionBlocksOutputCache',
                [
                    'cID' => $cID,
                    'cvID' => $cvID,
                    'bID' => $this->getBlockID(),
                    'arHandle' => $arHandle,
                    'btCachedBlockOutput' => $content,
                    'btCachedBlockOutputExpires' => $btCachedBlockOutputExpires,
                ],
                [
                    'cID',
                    'cvID',
                    'arHandle',
                    'bID',
                ],
                true
                );
        }
    }
public function setBlockCachedOutput ( $ content , $ lifetime , $ area ) { $ db = Loader :: db ( ) ; $ c = $ this -> getBlockCollectionObject ( ) ; $ btCachedBlockOutputExpires = strtotime ( '+5 years' ) ; if ( $ lifetime > 0 ) { $ btCachedBlockOutputExpires = time ( ) + $ lifetime ; } $ arHandle = $ this -> getAreaHandle ( ) ; $ cID = $ c -> getCollectionID ( ) ; $ cvID = $ c -> getVersionID ( ) ; if ( $ this -> isBlockInStack ( ) && is_object ( $ area ) ) { $ arHandle = $ area -> getAreaHandle ( ) ; $ cx = Page :: getCurrentPage ( ) ; $ cID = $ cx -> getCollectioniD ( ) ; $ cvID = $ cx -> getVersionID ( ) ; } if ( $ arHandle && $ cID && $ cvID ) { $ db -> Replace ( 'CollectionVersionBlocksOutputCache' , [ 'cID' => $ cID , 'cvID' => $ cvID , 'bID' => $ this -> getBlockID ( ) , 'arHandle' => $ arHandle , 'btCachedBlockOutput' => $ content , 'btCachedBlockOutputExpires' => $ btCachedBlockOutputExpires , ] , [ 'cID' , 'cvID' , 'arHandle' , 'bID' , ] , true ) ; } }
Set the output cache.

@param string $content the block output to be placed in the cache
@param int|null $lifetime The cache life time (in seconds). If empty we'll assume 5 years.
@param \Concrete\Core\Area\Area|null $area the stack area containing the block
Set the output cache .