downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

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 &gt;= 4.2.0, PHP 5)</p><p class="refpurpose"><span class="refname">session_cache_expire</span> &mdash; <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">&lt;?php<br /><br /></span><span style="color: #FF8000">/*&nbsp;set&nbsp;the&nbsp;cache&nbsp;limiter&nbsp;to&nbsp;'private'&nbsp;*/<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&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">session_cache_limiter</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/*&nbsp;set&nbsp;the&nbsp;cache&nbsp;expire&nbsp;to&nbsp;30&nbsp;minutes&nbsp;*/<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&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">session_cache_expire</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/*&nbsp;start&nbsp;the&nbsp;session&nbsp;*/<br /><br /></span><span style="color: #0000BB">session_start</span><span style="color: #007700">();<br /><br />echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;cache&nbsp;limiter&nbsp;is&nbsp;now&nbsp;set&nbsp;to&nbsp;</span><span style="color: #0000BB">$cache_limiter</span><span style="color: #DD0000">&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;cached&nbsp;session&nbsp;pages&nbsp;expire&nbsp;after&nbsp;</span><span style="color: #0000BB">$cache_expire</span><span style="color: #DD0000">&nbsp;minutes"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</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(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites