-
☆ A M B ☆
- 721 Posts
We have a client that has about 80 contexts and from time to time the Session table gets rather large and we have to repair it. Despite instructing them to Flush Sessions on a regular basis that is not happening.
Are there any strategies to automatically flush the sessions table or how can this be done in System Settings?
-
MODX Staff
- 10,725 Posts
You can configure sessions in MODX in a number of ways. By default, MODX uses a session_handler_class called modSessionHandler that stores sessions in the database table. It also preserves sessions for 7 days by default (see the session_cookie_lifetime and session_gc_maxlifetime System Settings, which both default to 806400 seconds). You can reduce this greatly, and subsequently the number of sessions in your table, by altering these settings to a much lower value, or you can choose to use the session_handler configured in your PHP.ini instead.
You can control these settings per Context as well. In your case, you might want to duplicate the current System Settings in the mgr Context to preserve the 7 day sessions there, then modify the System Settings so all 80 Contexts get the revised session configuration.
You can Flush Sessions at any time from the Manager (this will only affect sessions when using modSessionHandler), but this will destroy ALL sessions regardless of age.
-
☆ A M B ☆
- 721 Posts
Great, very much appreciated.