e34d87a16d31f5820b509b2838582520921c2cd7nd<?xml version='1.0' encoding='UTF-8' ?>
e34d87a16d31f5820b509b2838582520921c2cd7nd<!DOCTYPE manualpage SYSTEM "/style/manualpage.dtd">
e34d87a16d31f5820b509b2838582520921c2cd7nd<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd<!-- $LastChangedRevision$ -->
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd<!--
031b91a62d25106ae69d4693475c79618dd5e884fielding Licensed to the Apache Software Foundation (ASF) under one or more
031b91a62d25106ae69d4693475c79618dd5e884fielding contributor license agreements. See the NOTICE file distributed with
031b91a62d25106ae69d4693475c79618dd5e884fielding this work for additional information regarding copyright ownership.
031b91a62d25106ae69d4693475c79618dd5e884fielding The ASF licenses this file to You under the Apache License, Version 2.0
031b91a62d25106ae69d4693475c79618dd5e884fielding (the "License"); you may not use this file except in compliance with
031b91a62d25106ae69d4693475c79618dd5e884fielding the License. You may obtain a copy of the License at
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd http://www.apache.org/licenses/LICENSE-2.0
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd Unless required by applicable law or agreed to in writing, software
e34d87a16d31f5820b509b2838582520921c2cd7nd distributed under the License is distributed on an "AS IS" BASIS,
e34d87a16d31f5820b509b2838582520921c2cd7nd WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
e34d87a16d31f5820b509b2838582520921c2cd7nd See the License for the specific language governing permissions and
e34d87a16d31f5820b509b2838582520921c2cd7nd limitations under the License.
e34d87a16d31f5820b509b2838582520921c2cd7nd-->
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd<manualpage metafile="htcacheclean.xml.meta">
e34d87a16d31f5820b509b2838582520921c2cd7nd<parentdocument href="./">Programs</parentdocument>
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd<title>htcacheclean - Clean up the disk cache</title>
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd<summary>
e34d87a16d31f5820b509b2838582520921c2cd7nd <p><code>htcacheclean</code> is used to keep the size of
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin <module>mod_cache_disk</module>'s storage within a given size limit, or
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin limit on inodes in use. This tool can run either manually or in daemon mode.
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin When running in daemon mode, it sleeps in the background and checks the cache
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin directory at regular intervals for cached content to be removed. You can stop
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin the daemon cleanly by sending it a TERM or INT signal. When run manually, a
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin once off check of the cache directory is made for cached content to be
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin removed. If one or more URLs are specified, each URL will be deleted from
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin the cache, if present.</p>
e34d87a16d31f5820b509b2838582520921c2cd7nd</summary>
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin<seealso><module>mod_cache_disk</module></seealso>
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd<section id="synopsis"><title>Synopsis</title>
e34d87a16d31f5820b509b2838582520921c2cd7nd <p><code><strong>htcacheclean</strong>
e34d87a16d31f5820b509b2838582520921c2cd7nd [ -<strong>D</strong> ]
e34d87a16d31f5820b509b2838582520921c2cd7nd [ -<strong>v</strong> ]
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz [ -<strong>t</strong> ]
e34d87a16d31f5820b509b2838582520921c2cd7nd [ -<strong>r</strong> ]
e34d87a16d31f5820b509b2838582520921c2cd7nd [ -<strong>n</strong> ]
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin [ -<strong>R</strong><var>round</var> ]
e34d87a16d31f5820b509b2838582520921c2cd7nd -<strong>p</strong><var>path</var>
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin [-<strong>l</strong><var>limit</var>|
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin -<strong>L</strong><var>limit</var>]</code></p>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
2ba4873de1af40ce03d04cced3ed72057e320280rpluem <p><code><strong>htcacheclean</strong>
e34d87a16d31f5820b509b2838582520921c2cd7nd [ -<strong>n</strong> ]
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz [ -<strong>t</strong> ]
e34d87a16d31f5820b509b2838582520921c2cd7nd [ -<strong>i</strong> ]
5dc4220fc22561537ce1421a03e11846a5b719ebminfrin [ -<strong>P</strong><var>pidfile</var> ]
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin [ -<strong>R</strong><var>round</var> ]
e34d87a16d31f5820b509b2838582520921c2cd7nd -<strong>d</strong><var>interval</var>
e34d87a16d31f5820b509b2838582520921c2cd7nd -<strong>p</strong><var>path</var>
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin [-<strong>l</strong><var>limit</var>|
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin -<strong>L</strong><var>limit</var>]</code></p>
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <p><code><strong>htcacheclean</strong>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin [ -<strong>v</strong> ]
5876f43a746f688a32b7201bced8591ddf19bd43minfrin [ -<strong>R</strong><var>round</var> ]
5876f43a746f688a32b7201bced8591ddf19bd43minfrin -<strong>p</strong><var>path</var>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin [ -<strong>a</strong> ]
5876f43a746f688a32b7201bced8591ddf19bd43minfrin [ -<strong>A</strong> ]</code></p>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin <p><code><strong>htcacheclean</strong>
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin [ -<strong>D</strong> ]
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin [ -<strong>v</strong> ]
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin [ -<strong>t</strong> ]
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin [ -<strong>R</strong><var>round</var> ]
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin -<strong>p</strong><var>path</var>
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin <var>url</var></code></p>
e34d87a16d31f5820b509b2838582520921c2cd7nd</section>
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd<section id="options"><title>Options</title>
e34d87a16d31f5820b509b2838582520921c2cd7nd <dl>
e34d87a16d31f5820b509b2838582520921c2cd7nd <dt><code>-d<var>interval</var></code></dt>
e34d87a16d31f5820b509b2838582520921c2cd7nd <dd>Daemonize and repeat cache cleaning every <var>interval</var> minutes.
e34d87a16d31f5820b509b2838582520921c2cd7nd This option is mutually exclusive with the <code>-D</code>, <code>-v</code>
e34d87a16d31f5820b509b2838582520921c2cd7nd and <code>-r</code> options. To shutdown the daemon cleanly, just send it
e34d87a16d31f5820b509b2838582520921c2cd7nd a <code>SIGTERM</code> or <code>SIGINT</code>.</dd>
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd <dt><code>-D</code></dt>
e34d87a16d31f5820b509b2838582520921c2cd7nd <dd>Do a dry run and don't delete anything. This option is mutually
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin exclusive with the <code>-d</code> option. When doing a dry run and
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin deleting directories with <code>-t</code>, the inodes reported deleted
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin in the stats cannot take into account the directories deleted, and will
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin be marked as an estimate.</dd>
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd <dt><code>-v</code></dt>
e34d87a16d31f5820b509b2838582520921c2cd7nd <dd>Be verbose and print statistics. This option is mutually exclusive
e34d87a16d31f5820b509b2838582520921c2cd7nd with the <code>-d</code> option.</dd>
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd <dt><code>-r</code></dt>
e34d87a16d31f5820b509b2838582520921c2cd7nd <dd>Clean thoroughly. This assumes that the Apache web server is
e34d87a16d31f5820b509b2838582520921c2cd7nd not running (otherwise you may get garbage in the cache). This option
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz is mutually exclusive with the <code>-d</code> option and implies
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz the <code>-t</code> option.</dd>
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd <dt><code>-n</code></dt>
e34d87a16d31f5820b509b2838582520921c2cd7nd <dd>Be nice. This causes slower processing in favour of other
e34d87a16d31f5820b509b2838582520921c2cd7nd processes. <code>htcacheclean</code> will sleep from time to time
e34d87a16d31f5820b509b2838582520921c2cd7nd so that (a) the disk IO will be delayed and (b) the kernel can schedule
e34d87a16d31f5820b509b2838582520921c2cd7nd other processes in the meantime.</dd>
e34d87a16d31f5820b509b2838582520921c2cd7nd
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz <dt><code>-t</code></dt>
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz <dd>Delete all empty directories. By default only cache files are
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz removed, however with some configurations the large number of
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz directories created may require attention. If your configuration
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz requires a very large number of directories, to the point that
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim inode or file allocation table exhaustion may become an issue, use
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz of this option is advised.</dd>
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz
e34d87a16d31f5820b509b2838582520921c2cd7nd <dt><code>-p<var>path</var></code></dt>
e34d87a16d31f5820b509b2838582520921c2cd7nd <dd>Specify <var>path</var> as the root directory of the disk cache. This
e34d87a16d31f5820b509b2838582520921c2cd7nd should be the same value as specified with the <directive
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin module="mod_cache_disk">CacheRoot</directive> directive.</dd>
e34d87a16d31f5820b509b2838582520921c2cd7nd
5dc4220fc22561537ce1421a03e11846a5b719ebminfrin <dt><code>-P<var>pidfile</var></code></dt>
5dc4220fc22561537ce1421a03e11846a5b719ebminfrin <dd>Specify <var>pidfile</var> as the name of the file to write the
5dc4220fc22561537ce1421a03e11846a5b719ebminfrin process ID to when daemonized.</dd>
5dc4220fc22561537ce1421a03e11846a5b719ebminfrin
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin <dt><code>-R<var>round</var></code></dt>
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin <dd>Specify <var>round</var> as the amount to round sizes up to, to
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin compensate for disk block sizes. Set to the block size of the cache
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin partition.</dd>
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin
e34d87a16d31f5820b509b2838582520921c2cd7nd <dt><code>-l<var>limit</var></code></dt>
e34d87a16d31f5820b509b2838582520921c2cd7nd <dd>Specify <var>limit</var> as the total disk cache size limit. The value
e34d87a16d31f5820b509b2838582520921c2cd7nd is expressed in bytes by default (or attaching <code>B</code> to the
e34d87a16d31f5820b509b2838582520921c2cd7nd number). Attach <code>K</code> for Kbytes or <code>M</code> for
e34d87a16d31f5820b509b2838582520921c2cd7nd MBytes.</dd>
e34d87a16d31f5820b509b2838582520921c2cd7nd
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin <dt><code>-L<var>limit</var></code></dt>
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin <dd>Specify <var>limit</var> as the total disk cache inode limit.</dd>
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin
e34d87a16d31f5820b509b2838582520921c2cd7nd <dt><code>-i</code></dt>
e34d87a16d31f5820b509b2838582520921c2cd7nd <dd>Be intelligent and run only when there was a modification of the disk
e34d87a16d31f5820b509b2838582520921c2cd7nd cache. This option is only possible together with the <code>-d</code>
e34d87a16d31f5820b509b2838582520921c2cd7nd option.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt><code>-a</code></dt>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dd>List the URLs currently stored in the cache. Variants of the same URL
5876f43a746f688a32b7201bced8591ddf19bd43minfrin will be listed once for each variant.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt><code>-A</code></dt>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dd>List the URLs currently stored in the cache, along with their
5876f43a746f688a32b7201bced8591ddf19bd43minfrin attributes in the following order: url, header size, body size, status,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin entity version, date, expiry, request time, response time, body present,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin head request.</dd>
e34d87a16d31f5820b509b2838582520921c2cd7nd </dl>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin
e34d87a16d31f5820b509b2838582520921c2cd7nd</section>
e34d87a16d31f5820b509b2838582520921c2cd7nd
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin<section id="delete"><title>Deleting a specific URL</title>
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin <p>If <code>htcacheclean</code> is passed one or more URLs, each URL will
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin be deleted from the cache. If multiple variants of an URL exists, all
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin variants would be deleted.</p>
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin <p>When a reverse proxied URL is to be deleted, the effective URL is
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin constructed from the <strong>Host</strong> header, the
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin <strong>port</strong>, the <strong>path</strong> and the
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin <strong>query</strong>. Note the '?' in the URL must always be specified
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin explicitly, whether a query string is present or not. For example, an
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin attempt to delete the path <strong>/</strong> from the server
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin <strong>localhost</strong>, the URL to delete would be
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin <strong>http://localhost:80/?</strong>.</p>
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin</section>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin
5876f43a746f688a32b7201bced8591ddf19bd43minfrin<section id="list"><title>Listing URLs in the Cache</title>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <p>By passing the <code>-a</code> or <code>-A</code> options to
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <code>htcacheclean</code>, the URLs within the cache will be listed
5876f43a746f688a32b7201bced8591ddf19bd43minfrin as they are found, one URL per line. The <code>-A</code> option
5876f43a746f688a32b7201bced8591ddf19bd43minfrin dumps the full cache entry after the URL, with fields in the
5876f43a746f688a32b7201bced8591ddf19bd43minfrin following order:</p>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dl>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt>url</dt><dd>The URL of the entry.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt>header size</dt><dd>The size of the header in bytes.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt>body size</dt><dd>The size of the body in bytes.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt>status</dt><dd>Status of the cached response.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt>entity version</dt><dd>The number of times this entry has been
5876f43a746f688a32b7201bced8591ddf19bd43minfrin revalidated without being deleted.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt>date</dt><dd>Date of the response.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt>expiry</dt><dd>Expiry date of the response.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt>request time</dt><dd>Time of the start of the request.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt>response time</dt><dd>Time of the end of the request.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt>body present</dt><dd>If 0, no body is stored with this request,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin 1 otherwise.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin <dt>head request</dt><dd>If 1, the entry contains a cached HEAD
5876f43a746f688a32b7201bced8591ddf19bd43minfrin request with no body, 0 otherwise.</dd>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin </dl>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin
5876f43a746f688a32b7201bced8591ddf19bd43minfrin</section>
5876f43a746f688a32b7201bced8591ddf19bd43minfrin
e34d87a16d31f5820b509b2838582520921c2cd7nd<section id="exit"><title>Exit Status</title>
e34d87a16d31f5820b509b2838582520921c2cd7nd <p><code>htcacheclean</code> returns a zero status ("true") if all
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin operations were successful, <code>1</code> otherwise. If an URL is
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin specified, and the URL was cached and successfully removed,
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin <code>0</code> is returned, <code>2</code> otherwise. If an error
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin occurred during URL removal, <code>1</code> is returned.</p>
e34d87a16d31f5820b509b2838582520921c2cd7nd</section>
e34d87a16d31f5820b509b2838582520921c2cd7nd
e34d87a16d31f5820b509b2838582520921c2cd7nd</manualpage>