We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24531
    • 213 Posts
    i’m using getResources, getPage, getReqParam and custom snippet based on getReqParam:
    [[!getPage?  
       &elementClass=`modSnippet`  
       &element=`getResources`  
       &parents=`31`  
       &depth=`1`  
       &limit=`[[!If?
        &subject=`[[!getReqParam? &name=`limit` &type=`POST`]]`
        &operator=`notempty`
        &then=`[[!getReqParam? &name=`limit` &type=`POST`]]`
        &else=`5`
    ]]`  
       &pageVarKey=`page`
       &where=`[[!getCustomReqParam]]`
       &includeTVs=`1`
       &tvFilters=`[[!If?
        &subject=`[[!getReqParam? &name=`cat` &type=`POST`]]`
        &operator=`notempty`
        &then=`newsCategory==[[!getReqParam? &name=`cat` &type=`POST`]]`
        &else=``
    ]]` 
       &includeContent=`1`  
       &tpl=`news`  
    ]]


    looks kinda monstrous but it works just fine but only for the first request. i set this resource to be non-cached. So revo doesn’t create 31.cache.php in cache/web but still creates folder 31\1 where it puts "d41d8cd98f00b204e9800998ecf8427e.cache.php" file with something like that:
    <?php  return array (
      'properties' => 
      array (
        'namespace' => '',
        'limit' => 5,
        'offset' => 0,
        'page' => 1,
        'pageVarKey' => 'page',
        'totalVar' => 'total',
        'pageLimit' => 5,
        'elementClass' => 'modSnippet',
        'pageNavVar' => 'page.nav',
        'pageNavTpl' => '<li[[+classes]]><a[[+classes]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>',
        'pageActiveTpl' => '<li[[+activeClasses]]><a[[+activeClasses:default=` class="active"`]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>',
        'pageFirstTpl' => '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">First</a></li>',
        'pageLastTpl' => '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Last</a></li>',
        'pagePrevTpl' => '<li class="control"><a[[+classes]][[+title]] href="[[+href]]"><<</a></li>',
        'pageNextTpl' => '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">>></a></li>',
        'element' => 'getResources',
        'parents' => '31',
        'depth' => '1',
        'where' => '{"pagetitle:LIKE":"%новость%"}',
        'includeTVs' => '1',
        'tvFilters' => '',
        'includeContent' => '1',
        'tpl' => 'news',
        'total' => 1,
        'toPlaceholder' => '',
        'cache' => true,
        'cache_key' => 'default',
        'cache_handler' => 'xPDOFileCache',
        'cache_expires' => 0,
        'cachePageKey' => 'web/resources/31/1/d41d8cd98f00b204e9800998ecf8427e',
        'cacheOptions' => 
        array (
          'cache_key' => 'default',
          'cache_handler' => 'xPDOFileCache',
          'cache_expires' => 0,
        ),
        'qs' => 
        array (
        ),
        'pageCount' => 1,
        'firstItem' => 1,
        'lastItem' => 1,
        'pageUrl' => 'novosti-kompanii/',
      ),
      'output' => '<br style="clear:both;" />
    <span class="parent hidden">3</span>
    
    <div class="news" id="nid53">
      <h1>Новость 1</h2>
      <h3>Sep 09 2010</h3>
      <p align="center"></p>
      <a class="opener" rel="">показать полный текст</a>
      <div class="hiddenNews">
       Полный текст 1
      </div>
    </div> ',
    );


    I figured out that that cache_expires was set to 0 and i set it to 2 secs, it seems to solve my problem BUT it also renders cache mechanisms useless. Who needs cache with 2 seconds life-time?

    Now the question is: how do i COMPLETELY disable cache only for one page? i created simple snippet with
    <?php
    $modx->cacheManager->clearCache();
    but it seems that i missed something.
      • 22303 MODX Staff
      • 10,725 Posts
      The caching you are seeing is from getPage, not the Resource. If you don’t want it to cache the page by full request URI, disable the cache property for your getPage call, using &cache=`0`.
        • 24531
        • 213 Posts
        that solved the issue. however, it seems strange to me. i mean if i call any element with ! prefix it already means that it should be not cached, right?

        MODX is the greatest CMS i worked with but its documentation still lacks of consistency. I also often work with cakephp which requires a lot more effort while doing trivial things but it has waaaaaaaaaaaay better documentation!

        nevertheless, thanks for you help!
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: rav3n at Oct 24, 2010, 07:00 PM

          that solved the issue. however, it seems strange to me. i mean if i call any element with ! prefix it already means that it should be not cached, right?
          Right, but since the getPage Snippet itself has configurable caching features built-in to it meant to address the fact that caching is per Resource (and not per getPage’s idea of a page). There are many different types of caching, and partial Resource caching (aka partial page caching) is only one of them. Internal caching within a Snippet is completely different and allows you to create powerful and efficient caching strategies tailored to your needs.
            • 24531
            • 213 Posts
            you did a lot of good work with revolution, i’m absolutely in love with it and even consider to port old evo sites to it smiley