We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18608
    • 112 Posts
    I have at getResources call that looks like this:

    [[!getPage@elverPaging? &elementClass=`modSnippet` &sortby=`menuindex` &sortdir=`ASC` &limit=`32` &element=`getResources` &parents=`[[*id]]` &includeTVs=`1` &includeTVList=`produktFoto,produktserie,varenr,producent` &tpl=`produktBoks`]]
    [[!+page.nav]]


    There can be up to 150 children of the resource that it need to list.

    Right now (after the page has been cached)it takes around 1,5-2 sec. in pure server waiting time (on modx cloud) for the list to be generated, that's a long wait when the content hasn't even started loading yet.

    Does anyone have any ideas for how I can optimize the load time? (Skipping the TV's isn't a option, it has already been limited to the ones in the list)

    Edit: Using modx 2.2.5 on modxcloud.com with latest versions of getPage and getResources.

    This question has been answered by opengeek. See the first response.

    [ed. note: MathiasD last edited this post 13 years, 10 months ago.]
      Mathias Dannevang | Webdesigner at dannevang.org | Tweets @dannevang
      • 22303 MODX Staff
      • 10,725 Posts
      Once cached, these should be taking milliseconds to render. Are you executing uncached Snippets in your tpl( s )?
        • 18608
        • 112 Posts
        Quote from: opengeek at Dec 03, 2012, 08:49 AM
        Once cached, these should be taking milliseconds to render. Are you executing uncached Snippets in your tpl( s )?
        Only the getPage snippet, which as I understand it must be uncached.

        I tried isolating the getPage/getResources call on a empty template and call it from there - that reduced the time. I then found the getPage cache setting in my properties(see attached) that was set for no. I changed it to yes, and then (on the empty template) the call above has a php time on around 350ms when coming from cache - which is acceptable to me. But I'm not sure if changing the getPage cache setting has a unfortunate effect? Everything seems to be working fine.
          Mathias Dannevang | Webdesigner at dannevang.org | Tweets @dannevang
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          getPage has to be uncached so that it can generate subsequent pages of results. As long as you only have one page of results you won't see the problem, but if you have more than one you'll always only get that first page since the cached snippet no longer exists; it's been totally replaced by its initial output.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 18608
            • 112 Posts
            Quote from: sottwell at Dec 04, 2012, 03:22 AM
            getPage has to be uncached so that it can generate subsequent pages of results. As long as you only have one page of results you won't see the problem, but if you have more than one you'll always only get that first page since the cached snippet no longer exists; it's been totally replaced by its initial output.

            Hmm - yes, I see what you mean. On pages that isn't a container the ?page=2 returns the first page as well. On pages that is a container, and thereby ends with a trailing /, getpage still works fine...
              Mathias Dannevang | Webdesigner at dannevang.org | Tweets @dannevang
            • discuss.answer
              • 22303 MODX Staff
              • 10,725 Posts
              Right. You must call it uncached, but it has it's own caching built in which caches it's own output by Resource + unique Snippet properties + unique request parameters into the Resource cache partition.