<!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>Set cache control</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="httpresponse.setcache.html">HttpResponse::setCache</a></div> <div class="next" style="text-align: right; float: right;"><a href="httpresponse.setcontentdisposition.html">HttpResponse::setContentDisposition</a></div> <div class="up"><a href="class.httpresponse.html">HttpResponse</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="httpresponse.setcachecontrol" class="refentry"> <div class="refnamediv"> <h1 class="refname">HttpResponse::setCacheControl</h1> <p class="verinfo">(PECL pecl_http >= 0.10.0)</p><p class="refpurpose"><span class="refname">HttpResponse::setCacheControl</span> — <span class="dc-title">Set cache control</span></p> </div> <div class="refsect1 description" id="refsect1-httpresponse.setcachecontrol-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">static</span> <span class="type">bool</span> <span class="methodname"><strong>HttpResponse::setCacheControl</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$control</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$max_age</code><span class="initializer"> = 0</span></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$must_revalidate</code><span class="initializer"> = true</span></span> ]] )</div> <p class="para rdfs-comment"> Define a custom <em>Cache-Control</em> header, usually being <em class="emphasis">private</em> or <em class="emphasis">public</em>; </p> </div> <div class="refsect1 parameters" id="refsect1-httpresponse.setcachecontrol-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">control</code></em></span> <dd> <p class="para"> the primary cache control setting </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">max_age</code></em></span> <dd> <p class="para"> the max-age in seconds, suggesting how long the cache entry is valid on the client side </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">must_revalidate</code></em></span> <dd> <p class="para"> whether the cached entity should be revalidated by the client for every request </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-httpresponse.setcachecontrol-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success, or <strong><code>FALSE</code></strong> if control does not match one of <em class="emphasis">public</em>, <em class="emphasis">private</em> or <em class="emphasis">no-cache</em>. </p> </div> <div class="refsect1 seealso" id="refsect1-httpresponse.setcachecontrol-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="httpresponse.getcachecontrol.html" class="function" rel="rdfs-seeAlso">HttpResponse::getCacheControl()</a> - Get cache control</span></li> <li class="member"> <span class="function"><a href="httpresponse.setcache.html" class="function" rel="rdfs-seeAlso">HttpResponse::setCache()</a> - Set cache</span></li> <li class="member"> <span class="function"><a href="httpresponse.getcache.html" class="function" rel="rdfs-seeAlso">HttpResponse::getCache()</a> - Get cache</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="httpresponse.setcache.html">HttpResponse::setCache</a></div> <div class="next" style="text-align: right; float: right;"><a href="httpresponse.setcontentdisposition.html">HttpResponse::setContentDisposition</a></div> <div class="up"><a href="class.httpresponse.html">HttpResponse</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>