1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>htcacheclean - Clean up the disk cache - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <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" />
12 <script src="../style/scripts/prettify.js" type="text/javascript">
15 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
16 <body id="manual-page"><div id="page-header">
17 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
18 <p class="apache">Apache HTTP Server Version 2.5</p>
19 <img alt="" src="../images/feather.gif" /></div>
20 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
22 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://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>
24 <p><span>Available Languages: </span><a href="../en/programs/htcacheclean.html" title="English"> en </a> |
25 <a href="../ko/programs/htcacheclean.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
26 <a href="../tr/programs/htcacheclean.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
29 <p><code>htcacheclean</code> is used to keep the size of
30 <code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code>'s storage within a given size limit, or
31 limit on inodes in use. This tool can run either manually or in daemon mode.
32 When running in daemon mode, it sleeps in the background and checks the cache
33 directory at regular intervals for cached content to be removed. You can stop
34 the daemon cleanly by sending it a TERM or INT signal. When run manually, a
35 once off check of the cache directory is made for cached content to be
36 removed. If one or more URLs are specified, each URL will be deleted from
37 the cache, if present.</p>
39 <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#synopsis">Synopsis</a></li>
40 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
41 <li><img alt="" src="../images/down.gif" /> <a href="#delete">Deleting a specific URL</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#list">Listing URLs in the Cache</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#exit">Exit Status</a></li>
44 </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><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
45 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
47 <h2><a name="synopsis" id="synopsis">Synopsis</a></h2>
48 <p><code><strong>htcacheclean</strong>
49 [ -<strong>D</strong> ]
50 [ -<strong>v</strong> ]
51 [ -<strong>t</strong> ]
52 [ -<strong>r</strong> ]
53 [ -<strong>n</strong> ]
54 [ -<strong>R</strong><var>round</var> ]
55 -<strong>p</strong><var>path</var>
56 [-<strong>l</strong><var>limit</var>|
57 -<strong>L</strong><var>limit</var>]</code></p>
59 <p><code><strong>htcacheclean</strong>
60 [ -<strong>n</strong> ]
61 [ -<strong>t</strong> ]
62 [ -<strong>i</strong> ]
63 [ -<strong>P</strong><var>pidfile</var> ]
64 [ -<strong>R</strong><var>round</var> ]
65 -<strong>d</strong><var>interval</var>
66 -<strong>p</strong><var>path</var>
67 [-<strong>l</strong><var>limit</var>|
68 -<strong>L</strong><var>limit</var>]</code></p>
70 <p><code><strong>htcacheclean</strong>
71 [ -<strong>v</strong> ]
72 [ -<strong>R</strong><var>round</var> ]
73 -<strong>p</strong><var>path</var>
74 [ -<strong>a</strong> ]
75 [ -<strong>A</strong> ]</code></p>
77 <p><code><strong>htcacheclean</strong>
78 [ -<strong>D</strong> ]
79 [ -<strong>v</strong> ]
80 [ -<strong>t</strong> ]
81 [ -<strong>R</strong><var>round</var> ]
82 -<strong>p</strong><var>path</var>
83 <var>url</var></code></p>
84 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
86 <h2><a name="options" id="options">Options</a></h2>
88 <dt><code>-d<var>interval</var></code></dt>
89 <dd>Daemonize and repeat cache cleaning every <var>interval</var> minutes.
90 This option is mutually exclusive with the <code>-D</code>, <code>-v</code>
91 and <code>-r</code> options. To shutdown the daemon cleanly, just send it
92 a <code>SIGTERM</code> or <code>SIGINT</code>.</dd>
94 <dt><code>-D</code></dt>
95 <dd>Do a dry run and don't delete anything. This option is mutually
96 exclusive with the <code>-d</code> option. When doing a dry run and
97 deleting directories with <code>-t</code>, the inodes reported deleted
98 in the stats cannot take into account the directories deleted, and will
99 be marked as an estimate.</dd>
101 <dt><code>-v</code></dt>
102 <dd>Be verbose and print statistics. This option is mutually exclusive
103 with the <code>-d</code> option.</dd>
105 <dt><code>-r</code></dt>
106 <dd>Clean thoroughly. This assumes that the Apache web server is
107 not running (otherwise you may get garbage in the cache). This option
108 is mutually exclusive with the <code>-d</code> option and implies
109 the <code>-t</code> option.</dd>
111 <dt><code>-n</code></dt>
112 <dd>Be nice. This causes slower processing in favour of other
113 processes. <code>htcacheclean</code> will sleep from time to time
114 so that (a) the disk IO will be delayed and (b) the kernel can schedule
115 other processes in the meantime.</dd>
117 <dt><code>-t</code></dt>
118 <dd>Delete all empty directories. By default only cache files are
119 removed, however with some configurations the large number of
120 directories created may require attention. If your configuration
121 requires a very large number of directories, to the point that
122 inode or file allocation table exhaustion may become an issue, use
123 of this option is advised.</dd>
125 <dt><code>-p<var>path</var></code></dt>
126 <dd>Specify <var>path</var> as the root directory of the disk cache. This
127 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>
129 <dt><code>-P<var>pidfile</var></code></dt>
130 <dd>Specify <var>pidfile</var> as the name of the file to write the
131 process ID to when daemonized.</dd>
133 <dt><code>-R<var>round</var></code></dt>
134 <dd>Specify <var>round</var> as the amount to round sizes up to, to
135 compensate for disk block sizes. Set to the block size of the cache
138 <dt><code>-l<var>limit</var></code></dt>
139 <dd>Specify <var>limit</var> as the total disk cache size limit. The value
140 is expressed in bytes by default (or attaching <code>B</code> to the
141 number). Attach <code>K</code> for Kbytes or <code>M</code> for
144 <dt><code>-L<var>limit</var></code></dt>
145 <dd>Specify <var>limit</var> as the total disk cache inode limit.</dd>
147 <dt><code>-i</code></dt>
148 <dd>Be intelligent and run only when there was a modification of the disk
149 cache. This option is only possible together with the <code>-d</code>
152 <dt><code>-a</code></dt>
153 <dd>List the URLs currently stored in the cache. Variants of the same URL
154 will be listed once for each variant.</dd>
156 <dt><code>-A</code></dt>
157 <dd>List the URLs currently stored in the cache, along with their
158 attributes in the following order: url, header size, body size, status,
159 entity version, date, expiry, request time, response time, body present,
163 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
164 <div class="section">
165 <h2><a name="delete" id="delete">Deleting a specific URL</a></h2>
166 <p>If <code>htcacheclean</code> is passed one or more URLs, each URL will
167 be deleted from the cache. If multiple variants of an URL exists, all
168 variants would be deleted.</p>
170 <p>When a reverse proxied URL is to be deleted, the effective URL is
171 constructed from the <strong>Host</strong> header, the
172 <strong>port</strong>, the <strong>path</strong> and the
173 <strong>query</strong>. Note the '?' in the URL must always be specified
174 explicitly, whether a query string is present or not. For example, an
175 attempt to delete the path <strong>/</strong> from the server
176 <strong>localhost</strong>, the URL to delete would be
177 <strong>http://localhost:80/?</strong>.</p>
179 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
180 <div class="section">
181 <h2><a name="list" id="list">Listing URLs in the Cache</a></h2>
182 <p>By passing the <code>-a</code> or <code>-A</code> options to
183 <code>htcacheclean</code>, the URLs within the cache will be listed
184 as they are found, one URL per line. The <code>-A</code> option
185 dumps the full cache entry after the URL, with fields in the
189 <dt>url</dt><dd>The URL of the entry.</dd>
190 <dt>header size</dt><dd>The size of the header in bytes.</dd>
191 <dt>body size</dt><dd>The size of the body in bytes.</dd>
192 <dt>status</dt><dd>Status of the cached response.</dd>
193 <dt>entity version</dt><dd>The number of times this entry has been
194 revalidated without being deleted.</dd>
195 <dt>date</dt><dd>Date of the response.</dd>
196 <dt>expiry</dt><dd>Expiry date of the response.</dd>
197 <dt>request time</dt><dd>Time of the start of the request.</dd>
198 <dt>response time</dt><dd>Time of the end of the request.</dd>
199 <dt>body present</dt><dd>If 0, no body is stored with this request,
201 <dt>head request</dt><dd>If 1, the entry contains a cached HEAD
202 request with no body, 0 otherwise.</dd>
205 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
206 <div class="section">
207 <h2><a name="exit" id="exit">Exit Status</a></h2>
208 <p><code>htcacheclean</code> returns a zero status ("true") if all
209 operations were successful, <code>1</code> otherwise. If an URL is
210 specified, and the URL was cached and successfully removed,
211 <code>0</code> is returned, <code>2</code> otherwise. If an error
212 occurred during URL removal, <code>1</code> is returned.</p>
214 <div class="bottomlang">
215 <p><span>Available Languages: </span><a href="../en/programs/htcacheclean.html" title="English"> en </a> |
216 <a href="../ko/programs/htcacheclean.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
217 <a href="../tr/programs/htcacheclean.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
218 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
219 <script type="text/javascript"><!--//--><![CDATA[//><!--
220 var comments_shortname = 'httpd';
221 var comments_identifier = 'http://httpd.apache.org/docs/trunk/programs/htcacheclean.html';
223 if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
224 d.write('<div id="comments_thread"><\/div>');
225 var s = d.createElement('script');
226 s.type = 'text/javascript';
228 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
229 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
232 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
234 })(window, document);
235 //--><!]]></script></div><div id="footer">
236 <p class="apache">Copyright 2012 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
237 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
238 if (typeof(prettyPrint) !== 'undefined') {