We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    That's a good feature request for CacheMaster.

    In the meantime, there is always the "View" button on the edit page. That will put it in the cache.
      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
      • 39426
      • 15 Posts
      Thank you very much for your answers.

      I made a copy of this website and put the files on a webspace with an Apache. There the MODX manager is much faster than on the IIS Server! Probably there are some more tools to configure on the IIS Server to improve the performance (FastCGI Module, Cache Extension for PHP, PHP Manager for IIS). I will talk to the IT. Maybe that will be a solution.

      Now I realized that there's another caching issue (also at my website copy on the Apache Server). The website of my company has roundabout 500 to 1000 visitors a day, so all pages should be cached (by the content editors and by all the visitors).
      But when I open a page a few hours after I opened it the first time, it loads very slow again. It seems like a cache timeout, but in the system settings all caching timeouts are set to "0" (no timeout).

      Do you have an idea why the pages have something like a timeout anyway?

      Regards,
      Isabel
        • 3749
        • 24,544 Posts
        Sorry, no. Maybe someone else can tell us.
          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
          • 38290
          • 712 Posts
          You can also hook this puppy up to a CRON job.
          https://gist.github.com/opengeek/ec3f885cefe17e470aa1
          It will cache all cache able resources across all contexts. I run it every 10 minutes on heartroasters.com because there are a lot of URLs that wouldn't otherwise get hit often (AJAX on main page) like
          http://www.heartroasters.com/shop/colombia-el-desarollo/
            jpdevries
            • 16430
            • 217 Posts
            I dont know why but this PUPPY does nothing... I created a snippet and place this call to resource. When open reosource it returns server error...
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              It's not a snippet, it's a stand-alone PHP script.
                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
                • 32699 ☆ A M B ☆
                • 427 Posts
                This is how I do it as a FormIt hook:

                $wsw = false;
                $userId = $modx->user->get('id');
                $mySettings = array_merge(array(
                    'createdby' => $userId,
                    'published' => '1',
                    'publishedby' => $userId,
                    'publishedon' => time(),
                    'richtext' => 0,
                    'template' => '3',
                    'unpub_date' => time() + 2419200,
                ), $hook->getValues());
                $newResourceObj = $modx->newObject('modResource', $mySettings);
                $newResourceObj->set('alias', $mySettings['pagetitle']);
                $newResourceObj->set('refreshURIs', true);
                
                /* must return true or false for Formit Hooks to work */
                $wsw = $newResourceObj->save();
                
                return $wsw;
                


                This is from a classified ads site I through together in two days last year.

                The pages are created by the user filling out a form, injected into MODX, and the user is presented with a link on the Thank You page.


                But this is a page by page bases.

                To do all the pages in the site I suspect a Snippet which retrieves a collection of published modResources, loops through the array of objects, and runs the internal process function should do it.

                <?php
                $collection = $modx->getCollection('modResource', array('published' => '1'));
                if ($collection) {
                	foreach ($collection as $obj) {
                		$obj->process();
                		$modx->cacheManager->generateResource($obj);
                	}
                }
                


                After some hackery I through this together. Seems to work, but I wouldn't have that on a public page.


                By the way, IIS is much heavier on a web site, and the slowness you are experiencing can be a combination of any of the myriad of configuration settings on the server, domain controller, network, firewall, etc.

                It could also be due to a heavy system load. The number of visitors your site is experiencing is of little consequence, as that is only a few per hour.

                I would have the "Admin" look at the server load and find out what processes is dogging the server out. Tell them to turn off indexing on the website content as that is a waste of resources. There are dozens of other things that I can recommend, but he is in the position to know how to do it and look into it. [ed. note: wshawn last edited this post 13 years, 4 months ago.]
                  Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

                  Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
                  • 16430
                  • 217 Posts
                  Quote from: sottwell at Jun 06, 2013, 07:19 AM
                  It's not a snippet, it's a stand-alone PHP script.

                  so can you please tell me how to use it?
                    • 38290
                    • 712 Posts
                    Quote from: kudykam at Jun 06, 2013, 07:59 AM
                    Quote from: sottwell at Jun 06, 2013, 07:19 AM
                    It's not a snippet, it's a stand-alone PHP script.

                    so can you please tell me how to use it?

                    Look into setting up a CRON job in your hosting environment and make sure the path to the core is correct in the regencache php script
                      jpdevries
                      • 16430
                      • 217 Posts
                      I tried to run it through the cron job manager, but it returns server error... (other cronjobs works)
                      Update: It crashes on line:
                      require 'config.core.php';


                      Update2: I changed the line to absolute path like this:
                      require '/hosting/www/gvw.cz/ochutnavac/config.core.php';

                      which works, but returns error on next line:
                      require MODX_CORE_PATH . 'model/modx/modx.class.php';


                      config.core.php contains:
                      <?php
                      define('MODX_CORE_PATH', '/hosting/www/gvw.cz/ochutnavac/core/');
                      define('MODX_CONFIG_KEY', 'config');
                      ?>


                      Update3:
                      changing require to require_once make it works!:
                      require_once '/hosting/www/gvw.cz/ochutnavac/config.core.php';
                      require_once MODX_CORE_PATH.'model/modx/modx.class.php';


                      Update4:
                      When I run cron manager page via browser, scripts start working and caching resources until server cancel the task, probably due to some timeout limit.
                      When it is run by cron server it returns this cron manager error:
                       There was an error retrieving or creating session id: hpcfn0fa1tulgu2bjmb0icqr32
                      [ed. note: kudykam last edited this post 13 years, 4 months ago.]