| <!DOCTYPE html SYSTEM "about:legacy-compat"> | |
| <html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <meta content="width=device-width, initial-scale=1" name="viewport"> | |
| <!-- | |
| XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
| This file is generated from xml source: DO NOT EDIT | |
| XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
| --> | |
| <title>htcacheclean - Clean up the disk cache - Apache HTTP Server Version 2.5</title> | |
| <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet"> | |
| <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size"> | |
| <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css"><link rel="stylesheet" type="text/css" href="../style/css/prettify.css"> | |
| <script src="../style/scripts/prettify.min.js"> | |
| </script> | |
| <link href="../images/favicon.png" rel="shortcut icon"></head> | |
| <body id="manual-page"><div id="page-header"> | |
| <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="https://cwiki.apache.org/confluence/display/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a> | <a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2">Report a bug</a></p> | |
| <p class="apache">Apache HTTP Server Version 2.5</p> | |
| <img alt="" src="../images/feather.png"></div> | |
| <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif"></a></div> | |
| <div id="path"> | |
| <a href="https://www.apache.org/">Apache</a> > <a href="https://httpd.apache.org/">HTTP Server</a> > <a href="https://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Programs</a></div><div id="page-content"><div id="preamble"><h1>htcacheclean - Clean up the disk cache</h1> | |
| <button aria-label="Toggle language list" class="lang-toggle"><svg xmlns="http://www.w3.org/2000/svg" stroke-width="2" stroke="currentColor" fill="none" viewBox="0 0 24 24" height="16" width="16"><circle r="10" cy="12" cx="12"/><line y2="12" x2="22" y1="12" x1="2"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg></button> | |
| <div class="toplang"> | |
| <p><span>Available Languages: </span><a href="../en/programs/htcacheclean.html" title="English"> en </a> | | |
| <a href="../fr/programs/htcacheclean.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | | |
| <a href="../ko/programs/htcacheclean.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | | |
| <a href="../tr/programs/htcacheclean.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> | |
| </div> | |
| <p><code class="program"><a href="../programs/htcacheclean.html">htcacheclean</a></code> is used to keep the size of | |
| <code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code>'s storage within a given size limit, or | |
| limit on inodes in use. This tool can run either manually or in daemon mode. | |
| When running in daemon mode, it sleeps in the background and checks the cache | |
| directory at regular intervals for cached content to be removed. You can stop | |
| the daemon cleanly by sending it a TERM or INT signal. When run manually, a | |
| once off check of the cache directory is made for cached content to be | |
| removed. If one or more URLs are specified, each URL will be deleted from | |
| the cache, if present.</p> | |
| </div> | |
| <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif"> <a href="#synopsis">Synopsis</a></li> | |
| <li><img alt="" src="../images/down.gif"> <a href="#options">Options</a></li> | |
| <li><img alt="" src="../images/down.gif"> <a href="#delete">Deleting a specific URL</a></li> | |
| <li><img alt="" src="../images/down.gif"> <a href="#list">Listing URLs in the Cache</a></li> | |
| <li><img alt="" src="../images/down.gif"> <a href="#exit">Exit Status</a></li> | |
| <li><img alt="" src="../images/down.gif"> <a href="#files">Files</a></li> | |
| </ul><h3>See also</h3><ul class="seealso"><li><code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code></li></ul></div> | |
| <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"></a></div> | |
| <div class="section"> | |
| <h2 id="synopsis">Synopsis <a title="Permanent link" href="#synopsis" class="permalink">¶</a></h2> | |
| <p><code><strong>htcacheclean</strong> | |
| [ -<strong>D</strong> ] | |
| [ -<strong>v</strong> ] | |
| [ -<strong>t</strong> ] | |
| [ -<strong>r</strong> ] | |
| [ -<strong>n</strong> ] | |
| [ -<strong>R</strong><var>round</var> ] | |
| -<strong>p</strong><var>path</var> | |
| [ -<strong>l</strong><var>limit</var> ] | |
| [ -<strong>L</strong><var>limit</var> ]</code></p> | |
| <p><code><strong>htcacheclean</strong> | |
| [ -<strong>n</strong> ] | |
| [ -<strong>t</strong> ] | |
| [ -<strong>i</strong> ] | |
| [ -<strong>P</strong><var>pidfile</var> ] | |
| [ -<strong>R</strong><var>round</var> ] | |
| -<strong>d</strong><var>interval</var> | |
| -<strong>p</strong><var>path</var> | |
| [ -<strong>l</strong><var>limit</var> ] | |
| [ -<strong>L</strong><var>limit</var> ]</code></p> | |
| <p><code><strong>htcacheclean</strong> | |
| [ -<strong>v</strong> ] | |
| [ -<strong>R</strong><var>round</var> ] | |
| -<strong>p</strong><var>path</var> | |
| [ -<strong>a</strong> ] | |
| [ -<strong>A</strong> ]</code></p> | |
| <p><code><strong>htcacheclean</strong> | |
| [ -<strong>D</strong> ] | |
| [ -<strong>v</strong> ] | |
| [ -<strong>t</strong> ] | |
| [ -<strong>R</strong><var>round</var> ] | |
| -<strong>p</strong><var>path</var> | |
| <var>url</var></code></p> | |
| </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"></a></div> | |
| <div class="section"> | |
| <h2 id="options">Options <a title="Permanent link" href="#options" class="permalink">¶</a></h2> | |
| <dl> | |
| <dt><code>-d<var>interval</var></code></dt> | |
| <dd>Daemonize and repeat cache cleaning every <var>interval</var> minutes. | |
| This option is mutually exclusive with the <code>-D</code>, <code>-v</code> | |
| and <code>-r</code> options. To shutdown the daemon cleanly, just send it | |
| a <code>SIGTERM</code> or <code>SIGINT</code>.</dd> | |
| <dt><code>-D</code></dt> | |
| <dd>Do a dry run and don't delete anything. This option is mutually | |
| exclusive with the <code>-d</code> option. When doing a dry run and | |
| deleting directories with <code>-t</code>, the inodes reported deleted | |
| in the stats cannot take into account the directories deleted, and will | |
| be marked as an estimate.</dd> | |
| <dt><code>-v</code></dt> | |
| <dd>Be verbose and print statistics. This option is mutually exclusive | |
| with the <code>-d</code> option.</dd> | |
| <dt><code>-r</code></dt> | |
| <dd>Clean thoroughly. This assumes that the Apache web server is | |
| not running (otherwise you may get garbage in the cache). This option | |
| is mutually exclusive with the <code>-d</code> option and implies | |
| the <code>-t</code> option.</dd> | |
| <dt><code>-n</code></dt> | |
| <dd>Be nice. This causes slower processing in favor of other | |
| processes. <code class="program"><a href="../programs/htcacheclean.html">htcacheclean</a></code> will sleep from time to time | |
| so that (a) the disk IO will be delayed and (b) the kernel can schedule | |
| other processes in the meantime.</dd> | |
| <dt><code>-t</code></dt> | |
| <dd>Delete all empty directories. By default only cache files are | |
| removed, however with some configurations the large number of | |
| directories created may require attention. If your configuration | |
| requires a very large number of directories, to the point that | |
| inode or file allocation table exhaustion may become an issue, use | |
| of this option is advised.</dd> | |
| <dt><code>-p<var>path</var></code></dt> | |
| <dd>Specify <var>path</var> as the root directory of the disk cache. This | |
| should be the same value as specified with the <code class="directive"><a href="../mod/mod_cache_disk.html#cacheroot">CacheRoot</a></code> directive.</dd> | |
| <dt><code>-P<var>pidfile</var></code></dt> | |
| <dd>Specify <var>pidfile</var> as the name of the file to write the | |
| process ID to when daemonized.</dd> | |
| <dt><code>-R<var>round</var></code></dt> | |
| <dd>Specify <var>round</var> as the amount to round sizes up to, to | |
| compensate for disk block sizes. Set to the block size of the cache | |
| partition.</dd> | |
| <dt><code>-l<var>limit</var></code></dt> | |
| <dd>Specify <var>limit</var> as the total disk cache size limit. The value | |
| is expressed in bytes by default (or attaching <code>B</code> to the | |
| number). Attach <code>K</code> for Kbytes, <code>M</code> for | |
| MBytes or <code>G</code> for Gbytes.</dd> | |
| <dt><code>-L<var>limit</var></code></dt> | |
| <dd>Specify <var>limit</var> as the total disk cache inode limit. | |
| <code>K</code>, <code>M</code> or <code>G</code> suffix can also be | |
| used.</dd> | |
| <dt><code>-i</code></dt> | |
| <dd>Be intelligent and run only when there was a modification of the disk | |
| cache. This option is only possible together with the <code>-d</code> | |
| option.</dd> | |
| <dt><code>-a</code></dt> | |
| <dd>List the URLs currently stored in the cache. Variants of the same URL | |
| will be listed once for each variant.</dd> | |
| <dt><code>-A</code></dt> | |
| <dd>List the URLs currently stored in the cache, along with their | |
| attributes in the following order: url, header size, body size, status, | |
| entity version, date, expiry, request time, response time, body present, | |
| head request.</dd> | |
| </dl> | |
| </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"></a></div> | |
| <div class="section"> | |
| <h2 id="delete">Deleting a specific URL <a title="Permanent link" href="#delete" class="permalink">¶</a></h2> | |
| <p>If <code class="program"><a href="../programs/htcacheclean.html">htcacheclean</a></code> is passed one or more URLs, each URL will | |
| be deleted from the cache. If multiple variants of an URL exists, all | |
| variants would be deleted.</p> | |
| <p>When a reverse proxied URL is to be deleted, the effective URL is | |
| constructed from the <strong>Host</strong> header, the | |
| <strong>port</strong>, the <strong>path</strong> and the | |
| <strong>query</strong>. Note the '?' in the URL must always be specified | |
| explicitly, whether a query string is present or not. For example, an | |
| attempt to delete the path <strong>/</strong> from the server | |
| <strong>localhost</strong>, the URL to delete would be | |
| <strong>http://localhost:80/?</strong>.</p> | |
| </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"></a></div> | |
| <div class="section"> | |
| <h2 id="list">Listing URLs in the Cache <a title="Permanent link" href="#list" class="permalink">¶</a></h2> | |
| <p>By passing the <code>-a</code> or <code>-A</code> options to | |
| <code class="program"><a href="../programs/htcacheclean.html">htcacheclean</a></code>, the URLs within the cache will be listed | |
| as they are found, one URL per line. The <code>-A</code> option | |
| dumps the full cache entry after the URL, with fields in the | |
| following order:</p> | |
| <dl> | |
| <dt>url</dt><dd>The URL of the entry.</dd> | |
| <dt>header size</dt><dd>The size of the header in bytes.</dd> | |
| <dt>body size</dt><dd>The size of the body in bytes.</dd> | |
| <dt>status</dt><dd>Status of the cached response.</dd> | |
| <dt>entity version</dt><dd>The number of times this entry has been | |
| revalidated without being deleted.</dd> | |
| <dt>date</dt><dd>Timestamp of the response in microseconds.</dd> | |
| <dt>expiry</dt><dd>Expiry timestamp of the response in | |
| microseconds.</dd> | |
| <dt>request time</dt><dd>Timestamp of the start of the request in | |
| microseconds.</dd> | |
| <dt>response time</dt><dd>Timestamp of the end of the request in | |
| microseconds.</dd> | |
| <dt>body present</dt><dd>If 0, no body is stored with this request, | |
| 1 otherwise.</dd> | |
| <dt>head request</dt><dd>If 1, the entry contains a cached HEAD | |
| request with no body, 0 otherwise.</dd> | |
| </dl> | |
| </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"></a></div> | |
| <div class="section"> | |
| <h2 id="exit">Exit Status <a title="Permanent link" href="#exit" class="permalink">¶</a></h2> | |
| <p><code class="program"><a href="../programs/htcacheclean.html">htcacheclean</a></code> returns a zero status ("true") if all | |
| operations were successful, <code>1</code> otherwise. If an URL is | |
| specified, and the URL was cached and successfully removed, | |
| <code>0</code> is returned, <code>2</code> otherwise. If an error | |
| occurred during URL removal, <code>1</code> is returned.</p> | |
| </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"></a></div> | |
| <div class="section"> | |
| <h2 id="files">Files <a title="Permanent link" href="#files" class="permalink">¶</a></h2> | |
| <p>The cache root directory is specified as an argument on the command line | |
| and should match the <code>CacheRoot</code> directive in the server | |
| configuration.</p> | |
| <dl> | |
| <dt><var>path</var></dt> | |
| <dd>The root directory of the disk cache to be cleaned.</dd> | |
| </dl> | |
| </div></div> | |
| <div class="bottomlang"> | |
| <p><span>Available Languages: </span><a href="../en/programs/htcacheclean.html" title="English"> en </a> | | |
| <a href="../fr/programs/htcacheclean.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | | |
| <a href="../ko/programs/htcacheclean.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | | |
| <a href="../tr/programs/htcacheclean.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> | |
| </div><div id="footer"> | |
| <p class="apache">Copyright 2026 The Apache Software Foundation.<br>Licensed under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> | |
| <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="https://cwiki.apache.org/confluence/display/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a> | <a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2">Report a bug</a></p></div><script><!--//--><![CDATA[//><!-- | |
| if (typeof(prettyPrint) !== 'undefined') { | |
| prettyPrint(); | |
| } | |
| var langToggle = document.querySelector('.lang-toggle'); | |
| var topLang = document.querySelector('.toplang'); | |
| if (langToggle && topLang) { | |
| langToggle.addEventListener('click', function() { topLang.classList.toggle('open'); }); | |
| } | |
| var qv = document.getElementById('quickview'); | |
| if (qv) { | |
| document.body.appendChild(qv); | |
| var qvBtn = document.createElement('button'); | |
| qvBtn.className = 'qv-toggle'; | |
| qvBtn.setAttribute('aria-label', 'Toggle page navigation'); | |
| qvBtn.innerHTML = '☰'; | |
| document.body.appendChild(qvBtn); | |
| qvBtn.addEventListener('click', function() { | |
| var isOpen = qv.classList.toggle('open'); | |
| if (isOpen) { | |
| qv.style.top = window.scrollY + 10 + 'px'; | |
| } | |
| }); | |
| window.addEventListener('scroll', function() { qv.classList.remove('open'); }); | |
| } | |
| //--><!]]></script> | |
| </body></html> |