private static function caching($actionContext) {
        $cacheKey = InternalHelper::getPropertyValue($actionContext, 'cacheKey');

        // no key, no cache
        if (empty($cacheKey)) {
            return;
        }

        $cacheSettings = InternalHelper::getStaticPropertyValue('\\PhpMvc\\OutputCache', 'settings');
        $actionName = $actionContext->getActionName();
        $httpContext = $actionContext->getHttpContext();
        $response = $httpContext->getResponse();
        $cache = $httpContext->getCache();

        // cache duration
        if (!empty($cacheSettings[$actionName]['duration'])) {
            $duration = intval($cacheSettings[$actionName]['duration']);
        }
        elseif (!empty($cacheSettings['.']['duration'])) {
            $duration = intval($cacheSettings['.']['duration']);
        }
        else {
            $duration = 0;
        }

        // TODO: regionName
        $regionName = null;

        $dataToCache = array();

        // add response to cache
        if (($cachePartSeq = $cache->get($cacheKey . '_part_seq')) === null) {
            $dataToCache['statusCode'] = $response->getStatusCode();
            $dataToCache['statusDescription'] = $response->getStatusDescription();
            $dataToCache['headers'] = $response->getHeaders();
            $dataToCache['cookies'] = $response->getCookies();
            $dataToCache['files'] = InternalHelper::getPropertyValue($response, 'files');
            $dataToCache['output'] = InternalHelper::getPropertyValue($response, 'output');
        }
        else {
            $dataToCache['statusCode'] = $response->getStatusCode();
            $dataToCache['statusDescription'] = $response->getStatusDescription();
            $dataToCache['headers'] = $response->getHeaders();
            $dataToCache['cookies'] = $response->getCookies();
            $dataToCache['files'] = array();
            $dataToCache['output'] = '';

            for ($i = 0; $i < $cachePartSeq; ++$i) {
                $part = $cache->get($cacheKey . '_part_' . $i);

                if ($part !== null) {
                    $dataToCache['output'] .= $part['output'];
                    $dataToCache['files'] = array_merge($dataToCache['files'], $part['files']);
                    $cache->remove($cacheKey . '_part_' . $i);
                }
            }

            $cache->remove($cacheKey . '_part_seq');
        }

        $cache->add($cacheKey, $dataToCache, $duration, $regionName);
    }
private static function caching($actionContext) {
        $cacheKey = InternalHelper::getPropertyValue($actionContext, 'cacheKey');

        // no key, no cache
        if (empty($cacheKey)) {
            return;
        }

        $cacheSettings = InternalHelper::getStaticPropertyValue('\\PhpMvc\\OutputCache', 'settings');
        $actionName = $actionContext->getActionName();
        $httpContext = $actionContext->getHttpContext();
        $response = $httpContext->getResponse();
        $cache = $httpContext->getCache();

        // cache duration
        if (!empty($cacheSettings[$actionName]['duration'])) {
            $duration = intval($cacheSettings[$actionName]['duration']);
        }
        elseif (!empty($cacheSettings['.']['duration'])) {
            $duration = intval($cacheSettings['.']['duration']);
        }
        else {
            $duration = 0;
        }

        // TODO: regionName
        $regionName = null;

        $dataToCache = array();

        // add response to cache
        if (($cachePartSeq = $cache->get($cacheKey . '_part_seq')) === null) {
            $dataToCache['statusCode'] = $response->getStatusCode();
            $dataToCache['statusDescription'] = $response->getStatusDescription();
            $dataToCache['headers'] = $response->getHeaders();
            $dataToCache['cookies'] = $response->getCookies();
            $dataToCache['files'] = InternalHelper::getPropertyValue($response, 'files');
            $dataToCache['output'] = InternalHelper::getPropertyValue($response, 'output');
        }
        else {
            $dataToCache['statusCode'] = $response->getStatusCode();
            $dataToCache['statusDescription'] = $response->getStatusDescription();
            $dataToCache['headers'] = $response->getHeaders();
            $dataToCache['cookies'] = $response->getCookies();
            $dataToCache['files'] = array();
            $dataToCache['output'] = '';

            for ($i = 0; $i < $cachePartSeq; ++$i) {
                $part = $cache->get($cacheKey . '_part_' . $i);

                if ($part !== null) {
                    $dataToCache['output'] .= $part['output'];
                    $dataToCache['files'] = array_merge($dataToCache['files'], $part['files']);
                    $cache->remove($cacheKey . '_part_' . $i);
                }
            }

            $cache->remove($cacheKey . '_part_seq');
        }

        $cache->add($cacheKey, $dataToCache, $duration, $regionName);
    }
private static function caching ( $ actionContext ) { $ cacheKey = InternalHelper :: getPropertyValue ( $ actionContext , 'cacheKey' ) ; // no key, no cache if ( empty ( $ cacheKey ) ) { return ; } $ cacheSettings = InternalHelper :: getStaticPropertyValue ( '\\PhpMvc\\OutputCache' , 'settings' ) ; $ actionName = $ actionContext -> getActionName ( ) ; $ httpContext = $ actionContext -> getHttpContext ( ) ; $ response = $ httpContext -> getResponse ( ) ; $ cache = $ httpContext -> getCache ( ) ; // cache duration if ( ! empty ( $ cacheSettings [ $ actionName ] [ 'duration' ] ) ) { $ duration = intval ( $ cacheSettings [ $ actionName ] [ 'duration' ] ) ; } elseif ( ! empty ( $ cacheSettings [ '.' ] [ 'duration' ] ) ) { $ duration = intval ( $ cacheSettings [ '.' ] [ 'duration' ] ) ; } else { $ duration = 0 ; } // TODO: regionName $ regionName = null ; $ dataToCache = array ( ) ; // add response to cache if ( ( $ cachePartSeq = $ cache -> get ( $ cacheKey . '_part_seq' ) ) === null ) { $ dataToCache [ 'statusCode' ] = $ response -> getStatusCode ( ) ; $ dataToCache [ 'statusDescription' ] = $ response -> getStatusDescription ( ) ; $ dataToCache [ 'headers' ] = $ response -> getHeaders ( ) ; $ dataToCache [ 'cookies' ] = $ response -> getCookies ( ) ; $ dataToCache [ 'files' ] = InternalHelper :: getPropertyValue ( $ response , 'files' ) ; $ dataToCache [ 'output' ] = InternalHelper :: getPropertyValue ( $ response , 'output' ) ; } else { $ dataToCache [ 'statusCode' ] = $ response -> getStatusCode ( ) ; $ dataToCache [ 'statusDescription' ] = $ response -> getStatusDescription ( ) ; $ dataToCache [ 'headers' ] = $ response -> getHeaders ( ) ; $ dataToCache [ 'cookies' ] = $ response -> getCookies ( ) ; $ dataToCache [ 'files' ] = array ( ) ; $ dataToCache [ 'output' ] = '' ; for ( $ i = 0 ; $ i < $ cachePartSeq ; ++ $ i ) { $ part = $ cache -> get ( $ cacheKey . '_part_' . $ i ) ; if ( $ part !== null ) { $ dataToCache [ 'output' ] .= $ part [ 'output' ] ; $ dataToCache [ 'files' ] = array_merge ( $ dataToCache [ 'files' ] , $ part [ 'files' ] ) ; $ cache -> remove ( $ cacheKey . '_part_' . $ i ) ; } } $ cache -> remove ( $ cacheKey . '_part_seq' ) ; } $ cache -> add ( $ cacheKey , $ dataToCache , $ duration , $ regionName ) ; }
Caches the response, if possible.

@return void
Caches the response if possible .