We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31362
    • 2 Posts
    Hi,

    I want documents that are cached to have a lifetime of 1 hour.
    So after 1 hour the cached page should not be used anymore.

    Is there a way to let documents be cached for just 1 hour?
    Or can i set a cron to clean cache every hour?

    Thank you!
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: vdvm at Sep 21, 2008, 06:11 AM

      Hi,

      I want documents that are cached to have a lifetime of 1 hour.
      So after 1 hour the cached page should not be used anymore.

      Is there a way to let documents be cached for just 1 hour?
      Or can i set a cron to clean cache every hour?

      Thank you!
      You could use a cron to remove all the page cache files easy enough, or a plugin perhaps for the OnWebPageInit event that would check the filetime of the cache file if it exists, then delete it automatically if older than an hour.
        • 7231
        • 4,205 Posts
        1 hour for each visitor or one hour over all? So if I visit on the 59th minute of the hour after being on the site for one minute the cache would reset or only after being online for an hour? Just curious.
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don't know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 31362
          • 2 Posts
          The cache should have a lifetime of 1 hour. All visitors should see the same page from the cache.
          So, if i am the first visitor since an hour the pages i visit will be cached for 1 hour.
          The next visitor, within the hour, will see the same page as i did.

          A page, or all pages, should be deleted from the cache if it’s older then 1 hour.

          I could use a cron to ’Clear Cache’ but can i do that from a cron? Is there fi an API call?