<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Cleanup old sessions</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sessionhandler.destroy.html">SessionHandler::destroy</a></div> <div class="next" style="text-align: right; float: right;"><a href="sessionhandler.open.html">SessionHandler::open</a></div> <div class="up"><a href="class.sessionhandler.html">SessionHandler</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="sessionhandler.gc" class="refentry"> <div class="refnamediv"> <h1 class="refname">SessionHandler::gc</h1> <p class="verinfo">(PHP 5 >= 5.4.0)</p><p class="refpurpose"><span class="refname">SessionHandler::gc</span> — <span class="dc-title">Cleanup old sessions</span></p> </div> <div class="refsect1 description" id="refsect1-sessionhandler.gc-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><strong>SessionHandler::gc</strong></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$maxlifetime</code></span> )</div> <p class="para rdfs-comment"> Cleans up expired sessions. Called randomly by PHP internally when a session starts or when <span class="function"><a href="function.session-start.html" class="function">session_start()</a></span> is invoked. The frequency this is called is based on the <a href="session.configuration.html#ini.session.gc-divisor" class="link">session.gc_divisor</a> and <a href="session.configuration.html#ini.session.gc-probability" class="link">session.gc_probability</a> configuration directives. </p> <p class="para"> This method wraps the internal PHP save handler defined in the <a href="session.configuration.html#ini.session.save-handler" class="link">session.save_handler</a> ini setting that was set before this handler was set by <span class="function"><a href="function.session-set-save-handler.html" class="function">session_set_save_handler()</a></span>. </p> <p class="para"> If this class is extended by inheritiance, calling the parent <em><code class="parameter">gc</code></em> method will invoke the wrapper for this method and therefor invoke the associated internal callback. This allows this method to be overidden and or intercepted and filtered. </p> <p class="para"> For more information on what this method is expected to do, please refer to the documentation at <span class="function"><a href="sessionhandlerinterface.gc.html" class="function">SessionHandlerInterface::gc()</a></span>. </p> </div> <div class="refsect1 parameters" id="refsect1-sessionhandler.gc-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">maxlifetime</code></em></span> <dd> <p class="para"> Sessions that have not updated for the last <em><code class="parameter">maxlifetime</code></em> seconds will be removed. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-sessionhandler.gc-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The return value (usually <strong><code>TRUE</code></strong> on success, <strong><code>FALSE</code></strong> on failure). Note this value is returned internally to PHP for processing. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sessionhandler.destroy.html">SessionHandler::destroy</a></div> <div class="next" style="text-align: right; float: right;"><a href="sessionhandler.open.html">SessionHandler::open</a></div> <div class="up"><a href="class.sessionhandler.html">SessionHandler</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>