<!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>Return current cache expire</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.session.html">Session Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.session-cache-limiter.html">session_cache_limiter</a></div> <div class="up"><a href="ref.session.html">Session Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><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> <div class="refsect1 description" id="refsect1-function.session-cache-expire-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><strong>session_cache_expire</strong></span> ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$new_cache_expire</code></span> ] )</div> <p class="para rdfs-comment"> <span class="function"><strong>session_cache_expire()</strong></span> returns the current setting of <em>session.cache_expire</em>. </p> <p class="para"> The cache expire is reset to the default value of 180 stored in <a href="session.configuration.html#ini.session.cache-expire" class="link">session.cache_expire</a> at request startup time. Thus, you need to call <span class="function"><strong>session_cache_expire()</strong></span> for every request (and before <span class="function"><a href="function.session-start.html" class="function">session_start()</a></span> is called). </p> </div> <div class="refsect1 parameters" id="refsect1-function.session-cache-expire-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">new_cache_expire</code></em></span> <dd> <p class="para"> If <em><code class="parameter">new_cache_expire</code></em> is given, the current cache expire is replaced with <em><code class="parameter">new_cache_expire</code></em>. </p> <p class="para"> <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara"> Setting <em><code class="parameter">new_cache_expire</code></em> is of value only, if <em>session.cache_limiter</em> is set to a value <em class="emphasis">different</em> from <em>nocache</em>. </span> </p></blockquote> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.session-cache-expire-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the current setting of <em>session.cache_expire</em>. The value returned should be read in minutes, defaults to 180. </p> </div> <div class="refsect1 examples" id="refsect1-function.session-cache-expire-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-4765"> <p><strong>Example #1 <span class="function"><strong>session_cache_expire()</strong></span> example</strong></p> <div class="example-contents"> <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> </div> <div class="refsect1 seealso" id="refsect1-function.session-cache-expire-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="session.configuration.html#ini.session.cache-expire" class="link">session.cache_expire</a></li> <li class="member"><a href="session.configuration.html#ini.session.cache-limiter" class="link">session.cache_limiter</a></li> <li class="member"> <span class="function"><a href="function.session-cache-limiter.html" class="function" rel="rdfs-seeAlso">session_cache_limiter()</a> - Get and/or set the current cache limiter</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.session.html">Session Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.session-cache-limiter.html">session_cache_limiter</a></div> <div class="up"><a href="ref.session.html">Session Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>