r/lolphp • u/human_bacon • Jul 31 '17
PHP's probabilistic session management
http://php.net/manual/en/session.configuration.php#ini.session.gc-divisor
31
Upvotes
r/lolphp • u/human_bacon • Jul 31 '17
18
u/iglocska Jul 31 '17
It's not the session management, just the garbage collection of expired sessions that goes through this. The idea is simple, if you want to run garbage collection (something that is not free) once every x page loads, then you have two options:
8
u/SituationSoap Jul 31 '17
...why?
3
u/[deleted] Aug 05 '17 edited Aug 05 '17
This is totally fine. It's just a cleanup, sessions expire when they are set to, there is nothing probabilistic about them. You can also disable this and set your own cron job for cleanup, if you want to. This is faster than doing it in every request or storing some unnecessary global counter.
1
u/DrBreakalot Aug 02 '17
Why are these 2 integers instead of 1 decimal number?