Caching Page Blocks

is there any way to cache certain page blocks without caching the whole page?
I've enabled page blocks cache from Studio-->Settings but that does not seem to work. the Profiler still showing all the blocks 'not cached'. any advise on how the page blocks cache engine work? where can I set certain blocks to be cached?

  • 538
  • More
Replies (6)
    • There is no cache for separate page block for now.

      • thanks Alex T⚜️ , in that case, could you please help me understand a few things about the caching engine:
        1- what data is cached by the 'page cache' engine? does it include sql queries, css, js, html files ?
        2- currently, when we enable page caching, the CSS and JS files get messed up and not working giving a bizarre front for the page, how can I enable caching the sql queries / results without touching the CSS /JS files?
        3- is there any way to manipulate sql caching engine to capture certain queries for certain modules for longer periods than others ?

        • Hello Scholar !

          1. Pages cache stores the records from the pages and page blocks tables to reduce the refers to the database.

          2. Strange case, but you may disable the CSS and JS caches via Studio->Settings>Cache area.

          3. No, only via editing the core code.

          • Thanks LeonidS . Which class deals with page caching? and which methods determine the data to be cached?

            • You may find an example in the public function getCode () of template\scripts\BxBasePage.php class:

              $oCache = $this->_getPageCacheObject();

                          $sKey = $this->_getPageCacheKey();

                          $mixedRet = $oCache->getData($sKey, $this->_aObject['cache_lifetime']);

                          if ($mixedRet !== null) {

                              $sPageCode = $mixedRet;

                          } else {

                              $sPageCode = $this->_getPageCode();

                              $oCache->setData($sKey, $sPageCode, $this->_aObject['cache_lifetime']);

                          }

              • 1- what data is cached by the 'page cache' engine? does it include sql queries, css, js, html files ?
                2- currently, when we enable page caching, the CSS and JS files get messed up and not working giving a bizarre front for the page, how can I enable caching the sql queries / results without touching the CSS /JS files?
                3- is there any way to manipulate sql caching engine to capture certain queries for certain modules for longer periods than others ?

                1. page html without header and footer is cached

                2. that's correct because css and js files aren't part of page as specified in point 1, but added to head section of the page which isn't cache, so it's possible to cache only pages which don't use custom css/js files.

                3. usually sql/db cache is stored indefinitely and refreshes upon meeting some conditions, for example changing site domain or site revision number.

                Login or Join to comment.