PHP Garbage Collection clarification

后端 未结 3 976
终归单人心
终归单人心 2020-12-30 19:04

From the PHP manual, session.gc_probability and session.gc_divisor state that gc will occur based on this probability. I get that.

What I\'m not clear on is whether

3条回答
  •  醉酒成梦
    2020-12-30 19:44

    Every time a PHP script is executes and starts session there is a probability that it will sweep through the session folder killing off old session.

    Cleanup will only delete sessions which were not accessed within a certain time. However PHP does not guarantee that the session WILL be destroyed within that time.

    Your long-term session strategy should work just fine, but you might want to reduce 1% to something like 0.1%

    Another thing to look out for is that operating system might clean up your /tmp folder during reboot so even if PHP won't do it.

提交回复
热议问题