summaryrefslogtreecommitdiff
path: root/docs/manual/programs/htcacheclean.xml
blob: 8f75d1ff1ecdba5c1a796fb88ac646da064ecc5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<!-- $LastChangedRevision$ -->

<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<manualpage metafile="htcacheclean.xml.meta">
<parentdocument href="./">Programs</parentdocument>

<title>htcacheclean - Clean up the disk cache</title>

<summary>
    <p><code>htcacheclean</code> is used to keep the size of
    <module>mod_cache_disk</module>'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>
</summary>
<seealso><module>mod_cache_disk</module></seealso>

<section id="synopsis"><title>Synopsis</title>
    <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>
</section>

<section id="options"><title>Options</title>
    <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 favour of other
    processes. <code>htcacheclean</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 <directive
    module="mod_cache_disk">CacheRoot</directive> 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 or <code>M</code> for
    MBytes.</dd>

    <dt><code>-L<var>limit</var></code></dt>
    <dd>Specify <var>limit</var> as the total disk cache inode limit.</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>

</section>

<section id="delete"><title>Deleting a specific URL</title>
    <p>If <code>htcacheclean</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>

</section>

<section id="list"><title>Listing URLs in the Cache</title>
    <p>By passing the <code>-a</code> or <code>-A</code> options to
    <code>htcacheclean</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>Date of the response.</dd>
        <dt>expiry</dt><dd>Expiry date of the response.</dd>
        <dt>request time</dt><dd>Time of the start of the request.</dd>
        <dt>response time</dt><dd>Time of the end of the request.</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>

</section>

<section id="exit"><title>Exit Status</title>
    <p><code>htcacheclean</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>
</section>

</manualpage>