You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make session GC probability configurable via gcProbability and gcDivisor
parameters, mirroring PHP's session.gc_probability/session.gc_divisor.
Exposed through both SessionManager constructor and Builder::setSession().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: src/Server/Session/SessionManager.php
+18-1Lines changed: 18 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@
11
11
12
12
namespaceMcp\Server\Session;
13
13
14
+
useMcp\Exception\InvalidArgumentException;
14
15
usePsr\Log\LoggerInterface;
15
16
usePsr\Log\NullLogger;
16
17
useSymfony\Component\Uid\Uuid;
@@ -22,10 +23,22 @@
22
23
*/
23
24
class SessionManager implements SessionManagerInterface
24
25
{
26
+
/**
27
+
* @param int $gcProbability The probability (numerator) that GC will run on any given request. Combined with $gcDivisor to calculate the actual probability. Set to 0 to disable GC. Similar to PHP's session.gc_probability.
28
+
* @param int $gcDivisor The divisor used with $gcProbability to calculate GC probability. The probability is gcProbability/gcDivisor (e.g. 1/100 = 1%). Similar to PHP's session.gc_divisor.
0 commit comments