Source of: /manual/en/function.session-cache-expire.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.session.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.session-cache-expire.php',
1 => 'session_cache_expire',
),
'up' =>
array (
0 => 'ref.session.php',
1 => 'Session Functions',
),
'prev' =>
array (
0 => 'ref.session.php',
1 => 'Session Functions',
),
'next' =>
array (
0 => 'function.session-cache-limiter.php',
1 => 'session_cache_limiter',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.session-cache-expire" class="refentry">
<div class="refnamediv">
<h1 class="refname">session_cache_expire</h1>
<p class="verinfo">(PHP 4 >= 4.2.0, PHP 5)</p><p class="refpurpose"><span class="refname">session_cache_expire</span> — <span class="dc-title">Return current cache expire</span></p>
</div>
<a name="function.session-cache-expire.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type">int</span> <span class="methodname"><b>session_cache_expire</b></span>
([ <span class="methodparam"><span class="type">string</span> <tt class="parameter">$new_cache_expire</tt></span>
] )</div>
<p class="para rdfs-comment">
<b>session_cache_expire()</b> returns the current setting of
<i>session.cache_expire</i>.
</p>
<p class="para">
The cache expire is reset to the default value of 180 stored in
<i>session.cache_limiter</i> at request startup time. Thus,
you need to call <b>session_cache_expire()</b> for every
request (and before <a href="function.session-start.php" class="function">session_start()</a> is called).
</p>
</div>
<a name="function.session-cache-expire.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">new_cache_expire</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
If <i><tt class="parameter">new_cache_expire</tt></i>
is given, the current cache
expire is replaced with <i><tt class="parameter">new_cache_expire</tt></i>
.
</p>
<p class="para">
</p><blockquote><p><b class="note">Note</b>:
<span class="simpara">
Setting <i><tt class="parameter">new_cache_expire</tt></i>
is of value only, if
<i>session.cache_limiter</i> is set to a value
<em class="emphasis">different</em> from <i>nocache</i>.
</span>
</p></blockquote><p>
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.session-cache-expire.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns the current setting of <i>session.cache_expire</i>.
The value returned should be read in minutes, defaults to 180.
</p>
</div>
<a name="function.session-cache-expire.examples"></a><div class="refsect1 examples">
<h3 class="title">Examples</h3>
<p class="para">
</p><div class="example">
<p><b>Example #1 <b>session_cache_expire()</b> example</b></p>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">/* set the cache limiter to 'private' */<br /><br /></span><span style="color: #0000BB">session_cache_limiter</span><span style="color: #007700">(</span><span style="color: #DD0000">'private'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cache_limiter </span><span style="color: #007700">= </span><span style="color: #0000BB">session_cache_limiter</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/* set the cache expire to 30 minutes */<br /></span><span style="color: #0000BB">session_cache_expire</span><span style="color: #007700">(</span><span style="color: #0000BB">30</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cache_expire </span><span style="color: #007700">= </span><span style="color: #0000BB">session_cache_expire</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/* start the session */<br /><br /></span><span style="color: #0000BB">session_start</span><span style="color: #007700">();<br /><br />echo </span><span style="color: #DD0000">"The cache limiter is now set to </span><span style="color: #0000BB">$cache_limiter</span><span style="color: #DD0000"><br />"</span><span style="color: #007700">;<br />echo </span><span style="color: #DD0000">"The cached session pages expire after </span><span style="color: #0000BB">$cache_expire</span><span style="color: #DD0000"> minutes"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
</div><p>
</p>
</div>
<a name="function.session-cache-expire.seealso"></a><div class="refsect1 seealso">
<h3 class="title">See Also</h3>
<p class="para">
</p><ul class="simplelist">
<li class="member"><a href="session.configuration.php#ini.session.cache-expire" class="link">session.cache_expire</a></li>
<li class="member"><a href="session.configuration.php#ini.session.cache-limiter" class="link">session.cache_limiter</a></li>
<li class="member"><a href="function.session-cache-limiter.php" class="function" rel="rdfs-seeAlso">session_cache_limiter()</a> - Get and/or set the current cache limiter</li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>