Allow session garbace collection percentage to be configured. #1549

merged 3 commits into from Jul 1, 2012


None yet

2 participants


A hardcoded value of 5% is way too often for a large scale site, especially if you're getting bursts of traffic.

I'd personally like to see the probability calculated more along the lines of

rand()/divisor < probability, so you can have a percentage of less than one, but greater than 0.

Without that kind of granularity, I've found it's actually more efficient to run a cron job every minute to clean up stale sessions.

Any opinions on the matter?


If this is to be included in CI, the config setting should be prefixed with sess_, but I'd like it better if it just uses what's set in php.ini.


@narfbg -- I updated it so it will respect both gc_probability, and gc_divisor, as well as support floats/fractions of a percent.


Looks good to me. :) You'll need to add a changelog entry for this though: user_guide_src/source/changelog.rst


@narfbg My pleasure :)

@narfbg narfbg merged commit 3da427e into bcit-ci:develop Jul 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment