On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Version 1.1.0 works with both Resources and Elements!

    On a large site, MODX's default behavior of clearing the cache for all Resources whenever you save a Resource or Element can really slow things down for your visitors. The CacheMaster Plugin for MODX Revolution allows you to have the cache cleared for a single Resource or Element when you save it, without clearing anything else.

    It will also, optionally, uncheck the "Empty Cache" checkbox by default when you edit a Resource or Element.

    http://bobsguides.com/cachemaster-tutorial.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
    • Hi Bob,

      I've updated to this new release but 'am unable to save resources now, the progress bar just goes on and on.

      Didn't have an issue with the previous version, and saving templates and chuncks etc works just fine, it's just with resources.
      • Thanks for reporting that. There was a conflict with MODX 2.2.6. I just released Version 1.1.1. Try that. smiley
          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
        • Working fine now Bob, many thanks!
          • I'm glad it works. Thanks for reporting back. smiley
              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
            • Hi, how can I make Cachemaster to refresh cache of another document?
              I have news section in document 1 made with pdoResources. When I edit and sdave one of the news (eg. doc id 4) I want to refresh cache of document 1 or pdoResources chunk in that resource too.
              There are some problems with pdoResources uncached call so to see changes on news list (page 1)I have to clear all cache every time I edit single article.
              Thanks in advance.
              • That's why MODX refreshes the whole cache by default when you save a resource. wink

                CacheMaster has no way of knowing which chunks need the cache refreshed, so there's no way it can do that.

                You can make the chunk tag uncached. That should force it to be processed on every page load (though it will slow things down):

                [[!$ChunkName]]


                It might be better, though to replace the chunk tag with what's in the chunk and just call the pdoResources snippet uncached.

                You can also manually check the empty cache checkbox when you save a resource or clear the cache manually from the Site manu.
                  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
                • Thank you for your answer. For some reasons uncached call of pdoResources makes blank result.
                  I want to avoid clearing all cache becouse site is quite big.
                  I don't need universal solution, I think I need a simple plugin that refreshes cache of resource 1 where news are listed (every time I save other resources).
                  • I think this would do it in a plugin attached to the OnDocFormSave event.

                     $ctx = 'web'; /* or whatever context resource 1 is in */
                                $docId = 1;
                                $doc = $modx->getObject('modResource', $docId);
                    
                                $ck = $doc->getCacheKey();
                                $mgrCtx = $modx->context->get('key');
                                $cKey = str_replace($mgrCtx, $ctx, $ck);
                    
                                $modx->cacheManager->delete($cKey, array(
                                    xPDO::OPT_CACHE_KEY => $modx->getOption('cache_resource_key', null, 'resource'),
                                    xPDO::OPT_CACHE_HANDLER => $modx->getOption('cache_resource_handler', null,
                                        $modx->getOption(xPDO::OPT_CACHE_HANDLER)),
                                    xPDO::OPT_CACHE_FORMAT => (integer)$modx->getOption('cache_resource_format', null,
                                        $modx->getOption(xPDO::OPT_CACHE_FORMAT, null, xPDOCacheManager::CACHE_PHP))
                                    )
                                );


                    You might want to use this instead for the second line, in case you change the site_start page in the future:

                    $docId = $modx->getOption('site_start');
                      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
                    • It works fine. Now with your CacheMaster and this plugin my site is always fast. Thank You very much!