# session-cache-limiter

session_cache_limiter

Get and/or set the current cache limiter

# 

ENTITY

string

false

session_cache_limiter

string

null

value

ENTITY

`session_cache_limiter` returns the name of the current cache limiter.

The cache limiter defines which cache control HTTP headers are sent to the client. These headers determine the rules by which the page content may be cached by the client and intermediate proxies. Setting the cache limiter to `nocache` disallows any client/proxy caching. A value of `public` permits caching by proxies and the client, whereas `private` disallows caching by proxies and permits the client to cache the contents.

In `private` mode, the Expire header sent to the client may cause confusion for some browsers, including Mozilla. You can avoid this problem by using `private_no_expire` mode. The `Expire` header is never sent to the client in this mode.

Setting the cache limiter to `''` will turn off automatic sending of cache headers entirely.

The cache limiter is reset to the default value stored in [session.cache_limiter](#ini.session.cache-limiter) at request startup time. Thus, you need to call `session_cache_limiter` for every request (and before `session_start` is called).

# 

ENTITY

`value`  
If `value` is specified and not ENTITY, the name of the current cache limiter is changed to the new value.

<table>
<caption>Possible values</caption>
<thead>
<tr>
<th>Value</th>
<th>Headers sent</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>public</code></td>
<td><pre role="header"><code>Expires: (sometime in the future, according session.cache_expire)
Cache-Control: public, max-age=(sometime in the future, according to session.cache_expire)
Last-Modified: (the timestamp of the current script)
&#10;           </code></pre></td>
</tr>
<tr>
<td><code>private_no_expire</code></td>
<td><pre role="header"><code>Cache-Control: private, max-age=(session.cache_expire in the future)
Last-Modified: (the timestamp of the current script)
&#10;           </code></pre></td>
</tr>
<tr>
<td><code>private</code></td>
<td><pre role="header"><code>Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: private, max-age=(session.cache_expire in the future)
Last-Modified: (the timestamp of the current script)
&#10;           </code></pre></td>
</tr>
<tr>
<td><code>nocache</code></td>
<td><pre role="header"><code>Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
&#10;           </code></pre></td>
</tr>
</tbody>
</table>

# 

ENTITY

Returns the name of the current cache limiter. On failure to change the value, ENTITY is returned.

# 

ENTITY

| ENTITY | ENTITY                   |
|--------|--------------------------|
| 8.0.0  | `value` is nullable now. |

# 

ENTITY

<div class="example">

<div class="title">

`session_cache_limiter` example

</div>

```
<?php

/* set the cache limiter to 'private' */

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

echo "The cache limiter is now set to $cache_limiter<br />";
?>

    
```

</div>

# 

ENTITY

[session.cache_limiter](#ini.session.cache-limiter)