We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21671
    • 244 Posts
    I think that caching is confusing for the majority of developers using Revo. Which is not good considering it has such a huge impact on how performant your website is. I think that during Revo installation, it shoud ask you what type of site you are going to build, and how often you plan on changing content. The user should be given a few radio buttons to choose from. They should also be given helper text that explains how important caching is and how each choice will impact performance. There should also be a radio button, that is labeled expert with the helper text that says , "I'm fine thanks I will set my own caching settings."

    For the smaller static site, it would set far a future cache, for a news site or one where content changes daily, it would set a cache of 12 hours.

    This isn't the only way to do it, but I think it will help new users grasp how important it will be to the performance of their first site using modx. There are many things that are delightful about using revo; dealing with performance and caching is certainly not one of them.

    Smooth and intuitive should be the catchwords of how Revo should work, not complex and confusing. The former will grow the community of rabid adopters and the latter will shrink it.

    -Noah
    • There's no specific time for caching (well, there is for some objects, but assuming resources they are pretty much cached until the next change).

      Also, the default settings are pretty much the best settings AFAIK.

      The most important thing about caching is making sure you cache the tags that can be cacheable.

      So what options would you want to give during install?

      Edited
      I know your site is slow, so I just spent some time trying some things on the site on my server.

      Main thing I noticed is that the fixedpre plugin REALLY slows the site down. This is most notable in the blogs where you use it (and how I got to trying that in the first place). From 700-800ms cached to 200-300ms cached after disaling the plugin. Though obviously disabling that kills your <fixedpre> usage. On non-blog pages it also slows it down, from 350-400ms for your services page to 175-200ms after disabling it.
      [ed. note: markh last edited this post 12 years, 2 months ago.]
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 3749
        • 24,544 Posts
        That's interesting. Bob's Guides uses fixedpre a lot (usually wrapped inside pre tags). I haven't noticed it slowing things down, though I haven't done any formal timing.


        ---------------------------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
        MODX info for everyone: http://bobsguides.com/modx.html
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 21671
          • 244 Posts
          Bob,

          I got the idea to used fixed pre from your site I believe... Is there another best practice way to show code.. that doesn't involve a plugin? My memory is that the parser was stripping tags out of display using other tactics...

          -N
            • 33968
            • 863 Posts
            If this plugin is so slow, it might be better converted to an output modifier instead and applied to your content tag.

            Then you can only use it where necessary:
            [[*content:fixedpre]]
            The first load will take the performance hit but after that the content will come from the cache. I haven't tested this but I prefer this approach instead of running a heavy plugin on every page load for what is basically static content.
            • I manage snippets of code on my site with a MIGX TV where I simply paste in the code, give it a reference and also choose the syntax highlighting for it.

              Then where I want the code snippet to popup I just place a snippet call:
              [[source?reference=`reference I gave the code`]]

              That snippet takes the MIGX data, finds the right code snippet and processes it to prevent tags/html from being executed. It then wraps it in the proper markup for syntaxhighlighting or quotes.

              It works pretty good, I still need to blog about it..

              Here's the code for the snippet if it's any help, my MIGX TV is "mh.sources":
              $tv = $modx->resource->getTVValue('mh.sources');
              $data = $modx->fromJSON($tv);
              if (!is_array($data)) return;
              foreach ($data as $row) {
                if ($row['reference'] == $reference) { 
                  $content = $row['content'];
                  if ($row['syntaxhighlighting']) {
                     $content = str_replace(array('[',']'),array('[',']'),htmlentities($content, ENT_QUOTES, "UTF-8"));
                     if ($row['syntaxhighlighting'] == 'quote') {
                        $content = '<blockquote>' . trim(nl2br($content)) . '</blockquote>';
                     } else {
                       $content = '<div style="width: 98%"><pre class="brush: '.$row['syntaxhighlighting'].'">'.$content.'</pre></div>';
                     }
                  }
                  return $content;
                }
              } 
              return 'Reference '.$reference.' not found.';


              Ugh, the forum keeps eating up stuff.

              Line 8 above should be

                     $content = str_replace(array('[',']'),array('& #91;','& #93;'),htmlentities($content, ENT_QUOTES, "UTF-8"));

              except with no space between the &'s and #91/93. [ed. note: markh last edited this post 12 years, 2 months ago.]
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 21671
                • 244 Posts
                Hey Mark,

                Are you willing to take a few screen shots of your MIGX implementation described here?

                Thanks so much,

                Noah
                  • 3749
                  • 24,544 Posts
                  Quote from: noahlearner at Feb 26, 2012, 06:11 AM
                  Bob,

                  I got the idea to used fixed pre from your site I believe... Is there another best practice way to show code.. that doesn't involve a plugin? My memory is that the parser was stripping tags out of display using other tactics...
                  -N

                  Yes, the parser will process or remove all MODX tags and all PHP code. If you just want to show MODX tags, you can entify the brackets (that would be the fastest). It's hard to show in the forum. Like this, but with no space after the &:

                  & #91;& #91;SnippetName]] 




                  You can also write a plugin that inserts a space between the brackets in OnParseDocument and removes it in OnWebPagePrerender.


                  ---------------------------------------------------------------------------------------------------------------
                  PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
                  MODX info for everyone: http://bobsguides.com/modx.html [ed. note: BobRay last edited this post 12 years, 2 months ago.]
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                  • Are you willing to take a few screen shots of your MIGX implementation described here?
                    Sure thing. See attached screenshots from this article: http://www.markhamstra.com/modx-blog/2012/2/getting-values-from-within-a-modext-modx-window/
                      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.