We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8168
    • 1,118 Posts
    Hi - we have a modx_session table that grows too much for our liking on a popular MODX powered website. I have read that lowering the parameters on the session_gc_maxlifetime and session_cookie_lifetime settings would help make sure we don't keep as much data here... Looking at the current settings (which are default as per installation) and they are set to timestamp value of 604800 which equates to 1/8/1970, 1:00:00 AM - So looks like they are set to retain data since 1970! so no wonder they are getting huge...

    Question is - how can I set a timestamp value here to just keep the past say 10 days data and bin the rest on a rolling basis? I need a condition rather than a fixed timestamp?

    Any ideas?

    Cheers,

    dubbs.

    This question has been answered by BobRay. See the first response.

      • 8168
      • 1,118 Posts
      Anyone any ideas on a solution for this?
      • discuss.answer
        • 3749
        • 24,544 Posts
        The default value for session_gc_maxlifetime is 1440. It's not a timestamp value, it's the minimum time between garbage collections (sort of) in seconds, so 24 minutes.

        The session_cookie_lifetime is also in seconds (same default value), so 604800 sets it to one week.

        Setting both to 1440 would give you 24-minute sessions. One day would be 86400 seconds.



          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
          • 8168
          • 1,118 Posts
          Quote from: BobRay at Oct 31, 2017, 09:36 AM
          The default value for session_gc_maxlifetime is 1440. It's not a timestamp value, it's the minimum time between garbage collections (sort of) in seconds, so 24 minutes.

          The session_cookie_lifetime is also in seconds (same default value), so 604800 sets it to one week.

          Setting both to 1440 would give you 24-minute sessions. One day would be 86400 seconds.




          OK thanks - well both myn were set to 604800 - have shortened them to a day - so hopefully the size of the table wont grow too much anymore - I guess I need to nuke the table of old entries to get it to work with this new time setting in the manager? Or will it do it automatically?
            • 3749
            • 24,544 Posts
            It should clear out the older ones automatically, but I'd check anyway. wink
              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
              • 8168
              • 1,118 Posts
              Quote from: BobRay at Oct 31, 2017, 03:04 PM
              It should clear out the older ones automatically, but I'd check anyway. wink

              Ok thanks as ever Bob!