We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38290
    • 712 Posts
    I've written a blog post on a clever trick that utilizes the fact that MODX factors in the parameters passed into elements when cacheing them. By supplying a unique value, we can trick MODX into loading that fresh from cache.
    http://devries.jp/blog/2012/11/26/zap-your-cacheing-issues-with-getcache-and-cachebuster/

    This is especially usefully when working with the getCache Addon. getCache allows you to ensure that elements (Snippets or Chunks) are loaded quickly from cache even after content updates have been made to a site. It does this by allowing you to set how long the cache should live and serving the element from a cached file if it should and a file is found.

    The great thing about getCache is it basically lets you keep areas of your site cached even after content updates have been made. This means that when your client saves a resource, and the MODX cache thus gets cleared, users won't notice as much 'bogging' down on the front end of the site. It also means however, that outdated content could be loaded. We don't want that.

    Simply install cachebuster or use a System Setting of your own and pass it in as a parameter to the getCache snippet:
    [[!getCache@myGetResourcesPropertySet?
    &element=`getResources`
    &cacheKey=`persist_forever`
    &cacheExpires=`0`
    parents=`[[*id]]`
    &nc=`[[++cb.site_ver]]`]]
      jpdevries
      • 38290
      • 712 Posts
      It's not the easiest thing to do to instruct a client to update a System Setting, especially since there isn't a way to deep link to a specific namespace. For that reason, I'm considering adding a feature to cachebuster that displays some sort of 'Update Version' button which numerical increments your cs.site_ver System Setting.
        jpdevries
        • 1343 ☆ A M B ☆
        • 2,213 Posts
        Perhaps you could leverage ClientConfig (CMP Mark built at MODXpo) going forward?
          Patrick | Server Wrangler
          About Me: Website | Tweets |  MODX Hosting
          • 38290
          • 712 Posts
          Quote from: AMDbuilder at Nov 28, 2012, 06:36 PM
          Perhaps you could leverage ClientConfig (CMP Mark built at MODXpo) going forward?

          ClientConfig is perfect for this!
            jpdevries