We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38286
    • 13 Posts
    I am diving into modx caching and I am having a hard time understanding why the cache is getting cleared out every 5 or so minutes. Let me paint the picture.

    I venture over to the directory /core/cache/resource/web/resources and I watch the files being generated. I view a page on the website and it gets properly cached within this folder. Works great!

    However, if I wait for a few minutes, anywhere from 3-10 minutes, the "resources" directory is cleared out and everything has to be re-cached.

    My system settings for caching are attached. What is the default cache ttl for modx and are there any restrictions on how big the cache folder can get? Does a value of 0 mean live forever?
      • 22303 MODX Staff
      • 10,725 Posts
      The cache files live forever by default. They only get cleared when you save changes in the manager.
        • 38286
        • 13 Posts
        Thanks for the reply back. I thought they lived forever until I cleared it or made changes. I never log into my production box and make changes to modx. I do all changes on dev then push to prod (clearing cache during this push). When I FTP into prod and look at the files I can see them being removed without ever being logged into modx's manager. I wonder if a package is deleting them?
          • 38286
          • 13 Posts
          I have not been in the modx manager at all today. I have visited at least 30 pages on the website though and the attached screenshot is the current cache folder for "/core/cache/resource/web/resources/". Doesn't make any sense.
            • 22303 MODX Staff
            • 10,725 Posts
            You certainly could have a plugin or snippet that is clearing the cache...
              • 38286
              • 13 Posts
              I think I found it. It's when I use getPage with Archivist. I set cache to 1 for the getPage snippet parameter but that still didn't work because I later found out that just makes a new directory to store all of the new variations of a dynamic resource.

              So I knew that getPage was working fine. I then changed a true parameter to false inside the getArchives snippet and everything is working fine now. However, I have no clue why and I believe that the makeArchives function is never being called, even though the site has not lost any functionality.

              Two files are attached. One of my getPage call and the other of the getArchives snippet which is called by getPage. Notice on getArchives i changed the 'true' to 'false', but like I said above, I have no clue why this works.