Skip to content

Instantly share code, notes, and snippets.

@robbinhan
Created May 31, 2013 15:31
Show Gist options
  • Save robbinhan/5685786 to your computer and use it in GitHub Desktop.
Save robbinhan/5685786 to your computer and use it in GitHub Desktop.
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
这三个配置组合构建服务端session的垃圾回收机制
session.gc_probability与session.gc_divisor构成执行session清理的概率,理论上的解释为服务端定期有一定的概率调用gc函数来对session进行清理,清理的概率为:
gc_probability/gc_divisor 比如:1/100 表示每一个新会话初始化时(session_start),有1%的概率会启动垃圾回收程序,清理的标准为session.gc_maxlifetime定义的时间。
我写了一篇关于结合http分析php session 本质的文章,有兴趣的话可以看下 - http://www.360weboy.com/php/session-c...
我接下来写一篇关于php session内部执行的整个的详细步骤的文章在博客中
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment