<!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>Deletes files from the opcode cache</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.apc-define-constants.html">apc_define_constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.apc-delete.html">apc_delete</a></div> <div class="up"><a href="ref.apc.html">APC Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.apc-delete-file" class="refentry"> <div class="refnamediv"> <h1 class="refname">apc_delete_file</h1> <p class="verinfo">(PECL apc >= 3.1.1)</p><p class="refpurpose"><span class="refname">apc_delete_file</span> — <span class="dc-title">Deletes files from the opcode cache</span></p> </div> <div class="refsect1 description" id="refsect1-function.apc-delete-file-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>apc_delete_file</strong></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$keys</code></span> )</div> <p class="para rdfs-comment"> Deletes the given files from the opcode cache. </p> </div> <div class="refsect1 parameters" id="refsect1-function.apc-delete-file-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">keys</code></em></span> <dd> <p class="para"> The files to be deleted. Accepts a <span class="type"><a href="language.types.string.html" class="type string">string</a></span>, <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of strings, or an <a href="class.apciterator.html" class="classname">APCIterator</a> <span class="type"><a href="language.types.object.html" class="type object">object</a></span>. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-function.apc-delete-file-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. Or if <em><code class="parameter">keys</code></em> is an <span class="type"><a href="language.types.array.html" class="type array">array</a></span>, then an empty array is returned on success, or an array of failed files is returned. </p> </div> <div class="refsect1 examples" id="refsect1-function.apc-delete-file-examples"> <h3 class="title">Examples</h3> <div class="example" id="example-410"> <p><strong>Example #1 <span class="function"><strong>apc_delete_file()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$filename </span><span style="color: #007700">= </span><span style="color: #DD0000">'file.php'</span><span style="color: #007700">;<br /><br />if (</span><span style="color: #0000BB">apc_compile_file</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">)) {<br /><br /> if (</span><span style="color: #0000BB">apc_delete_file</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">)) {<br /> echo </span><span style="color: #DD0000">"Successfully deleted file </span><span style="color: #0000BB">$filename</span><span style="color: #DD0000"> from APC cache."</span><span style="color: #007700">, </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /> }<br />}<br /><br />if (</span><span style="color: #0000BB">apc_compile_file</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">)) {<br /><br /> if (</span><span style="color: #0000BB">$good </span><span style="color: #007700">= </span><span style="color: #0000BB">apc_delete_file</span><span style="color: #007700">(array(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">, </span><span style="color: #DD0000">'donotexist.php'</span><span style="color: #007700">))) {<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$good</span><span style="color: #007700">);<br /> }<br />}<br /><br /></span><span style="color: #0000BB">$bad </span><span style="color: #007700">= </span><span style="color: #0000BB">apc_delete_file</span><span style="color: #007700">(</span><span style="color: #DD0000">'donotexist.php'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$bad</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> Successfully deleted file file.php from APC cache. [Mon May 24 09:30:33 2010] [apc-warning] Could not stat file donotexist.php, unable to delete from cache. in /tmp/test.php on line 13. array(1) { [0]=> string(14) "donotexist.php" } [Mon May 24 09:30:33 2010] [apc-warning] Could not stat file donotexist.php, unable to delete from cache. in /tmp/test.php on line 18. bool(false) </pre></div> </div> </div> </div> <div class="refsect1 seealso" id="refsect1-function.apc-delete-file-seealso"> <h3 class="title">See Also</h3> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.apc-clear-cache.html" class="function" rel="rdfs-seeAlso">apc_clear_cache()</a> - Clears the APC cache</span></li> <li class="member"> <span class="function"><a href="function.apc-delete.html" class="function" rel="rdfs-seeAlso">apc_delete()</a> - Removes a stored variable from the cache</span></li> <li class="member"> <span class="function"><a href="function.apc-exists.html" class="function" rel="rdfs-seeAlso">apc_exists()</a> - Checks if APC key exists</span></li> </ul> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.apc-define-constants.html">apc_define_constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.apc-delete.html">apc_delete</a></div> <div class="up"><a href="ref.apc.html">APC Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>