1 <?xml version='1.0' encoding='UTF-8' ?>
2 <!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <manualpage metafile="htcacheclean.xml.meta">
24 <parentdocument href="./">Programs</parentdocument>
26 <title>htcacheclean - Clean up the disk cache</title>
29 <p><code>htcacheclean</code> is used to keep the size of
30 <module>mod_disk_cache</module>'s storage within a certain limit. This
31 tool can run either manually or in daemon mode. When running in
32 daemon mode, it sleeps in the background and checks the cache directory
33 at regular intervals for cached content to be removed. You can stop the daemon
34 cleanly by sending it a TERM or INT signal. When run manually, a once off
35 check of the cache directory is made for cached content to be removed. If
36 one or more URLs are specified, each URL will be deleted from the cache, if
39 <seealso><module>mod_disk_cache</module></seealso>
41 <section id="synopsis"><title>Synopsis</title>
42 <p><code><strong>htcacheclean</strong>
43 [ -<strong>D</strong> ]
44 [ -<strong>v</strong> ]
45 [ -<strong>t</strong> ]
46 [ -<strong>r</strong> ]
47 [ -<strong>n</strong> ]
48 [ -<strong>R</strong><var>round</var> ]
49 -<strong>p</strong><var>path</var>
50 -<strong>l</strong><var>limit</var></code></p>
52 <p><code><strong>htcacheclean</strong>
53 [ -<strong>n</strong> ]
54 [ -<strong>t</strong> ]
55 [ -<strong>i</strong> ]
56 [ -<strong>P</strong><var>pidfile</var> ]
57 [ -<strong>R</strong><var>round</var> ]
58 -<strong>d</strong><var>interval</var>
59 -<strong>p</strong><var>path</var>
60 -<strong>l</strong><var>limit</var></code></p>
62 <p><code><strong>htcacheclean</strong>
63 [ -<strong>D</strong> ]
64 [ -<strong>v</strong> ]
65 [ -<strong>t</strong> ]
66 [ -<strong>R</strong><var>round</var> ]
67 -<strong>p</strong><var>path</var>
68 <var>url</var></code></p>
71 <section id="options"><title>Options</title>
73 <dt><code>-d<var>interval</var></code></dt>
74 <dd>Daemonize and repeat cache cleaning every <var>interval</var> minutes.
75 This option is mutually exclusive with the <code>-D</code>, <code>-v</code>
76 and <code>-r</code> options. To shutdown the daemon cleanly, just send it
77 a <code>SIGTERM</code> or <code>SIGINT</code>.</dd>
79 <dt><code>-D</code></dt>
80 <dd>Do a dry run and don't delete anything. This option is mutually
81 exclusive with the <code>-d</code> option.</dd>
83 <dt><code>-v</code></dt>
84 <dd>Be verbose and print statistics. This option is mutually exclusive
85 with the <code>-d</code> option.</dd>
87 <dt><code>-r</code></dt>
88 <dd>Clean thoroughly. This assumes that the Apache web server is
89 not running (otherwise you may get garbage in the cache). This option
90 is mutually exclusive with the <code>-d</code> option and implies
91 the <code>-t</code> option.</dd>
93 <dt><code>-n</code></dt>
94 <dd>Be nice. This causes slower processing in favour of other
95 processes. <code>htcacheclean</code> will sleep from time to time
96 so that (a) the disk IO will be delayed and (b) the kernel can schedule
97 other processes in the meantime.</dd>
99 <dt><code>-t</code></dt>
100 <dd>Delete all empty directories. By default only cache files are
101 removed, however with some configurations the large number of
102 directories created may require attention. If your configuration
103 requires a very large number of directories, to the point that
104 inode or file allocation table exhaustion may become an issue, use
105 of this option is advised.</dd>
107 <dt><code>-p<var>path</var></code></dt>
108 <dd>Specify <var>path</var> as the root directory of the disk cache. This
109 should be the same value as specified with the <directive
110 module="mod_disk_cache">CacheRoot</directive> directive.</dd>
112 <dt><code>-P<var>pidfile</var></code></dt>
113 <dd>Specify <var>pidfile</var> as the name of the file to write the
114 process ID to when daemonized.</dd>
116 <dt><code>-R<var>round</var></code></dt>
117 <dd>Specify <var>round</var> as the amount to round sizes up to, to
118 compensate for disk block sizes. Set to the block size of the cache
121 <dt><code>-l<var>limit</var></code></dt>
122 <dd>Specify <var>limit</var> as the total disk cache size limit. The value
123 is expressed in bytes by default (or attaching <code>B</code> to the
124 number). Attach <code>K</code> for Kbytes or <code>M</code> for
127 <dt><code>-i</code></dt>
128 <dd>Be intelligent and run only when there was a modification of the disk
129 cache. This option is only possible together with the <code>-d</code>
134 <section id="delete"><title>Deleting a specific URL</title>
135 <p>If <code>htcacheclean</code> is passed one or more URLs, each URL will
136 be deleted from the cache. If multiple variants of an URL exists, all
137 variants would be deleted.</p>
139 <p>When a reverse proxied URL is to be deleted, the effective URL is
140 constructed from the <strong>Host</strong> header, the
141 <strong>port</strong>, the <strong>path</strong> and the
142 <strong>query</strong>. Note the '?' in the URL must always be specified
143 explicitly, whether a query string is present or not. For example, an
144 attempt to delete the path <strong>/</strong> from the server
145 <strong>localhost</strong>, the URL to delete would be
146 <strong>http://localhost:80/?</strong>.</p>
150 <section id="exit"><title>Exit Status</title>
151 <p><code>htcacheclean</code> returns a zero status ("true") if all
152 operations were successful, <code>1</code> otherwise. If an URL is
153 specified, and the URL was cached and successfully removed,
154 <code>0</code> is returned, <code>2</code> otherwise. If an error
155 occurred during URL removal, <code>1</code> is returned.</p>