HTCACHECLEAN(8)
๐ HTCACHECLEAN(8) ๐
okay bestie, this is htcacheclean โ the section 8 (system admin) manual page, and she's literally the girl who keeps your disk cache from eating your whole hard drive. no cap. let's get into it โจ
๐ธ NAME ๐ธ
htcacheclean โ Clean up the disk cache ๐งนโจ
๐ SYNOPSIS ๐
htcacheclean [ -D ] [ -v ] [ -t ] [ -r ] [ -n ] [ -Rround ] -ppath [
-llimit ] [ -Llimit ]
htcacheclean [ -n ] [ -t ] [ -i ] [ -Ppidfile ] [ -Rround ] -dinterval
-ppath [ -llimit ] [ -Llimit ]
htcacheclean [ -v ] [ -Rround ] -ppath [ -a ] [ -A ]
htcacheclean [ -D ] [ -v ] [ -t ] [ -Rround ] -ppath url
๐ฆ SUMMARY ๐ฆ
so htcacheclean exists to keep the size of mod_cache_disk's storage inside a given size limit, or inside a limit on the inodes in use. she can run manually or in daemon mode, your call ๐
when she's in daemon mode, she sleeps in the background and checks the cache directory at regular intervals for cached content that needs to go ๐๏ธ
and the way you stop the daemon cleanly? just send her a TERM or INT signal. she'll wrap it up, no drama ๐ซถ
when you run her manually, it's a once-off check of the cache directory for cached content to be removed. and if you specify one or more URLs, each URL gets deleted from the cache, if it's present ๐
โจ OPTIONS โจ
-dintervalโ daemonize and repeat cache cleaning every interval minutes. this one is mutually exclusive with-D,-vand-r. to shut the daemon down cleanly, just send it aSIGTERMorSIGINT๐-Dโ do a dry run, don't delete anything. mutually exclusive with-d. and heads up bestie, when you're doing a dry run and deleting directories with-t, the inodes reported deleted in the stats can't take the deleted directories into account, so they'll be marked as an estimate ๐-vโ be verbose and print statistics. mutually exclusive with-dโจ-rโ clean thoroughly. this assumes the Apache web server is not running (otherwise you may get garbage in the cache ๐ญ). mutually exclusive with-d, and it implies-t-nโ be nice ๐ฅบ this causes slower processing in favor of other processes.htcachecleanwill sleep from time to time so that (a) the disk IO gets delayed and (b) the kernel can schedule other processes in the meantime-tโ delete all empty directories. by default only cache files are removed, but with some configurations the huge number of directories created may need attention. if your config needs a very large number of directories โ to the point that inode or file allocation table exhaustion could become an issue โ use of this option is advised โ ๏ธ-ppathโ specify path as the root directory of the disk cache. this should be the same value you specified with theCacheRootdirective ๐-Ppidfileโ specify pidfile as the name of the file to write the process ID to when daemonized ๐-Rroundโ specify round as the amount to round sizes up to, to compensate for disk block sizes. set it to the block size of the cache partition ๐ข-llimitโ specify limit as the total disk cache size limit. the value is expressed in bytes by default (or by attachingBto the number). attachKfor Kbytes,Mfor MBytes orGfor Gbytes ๐พ-Llimitโ specify limit as the total disk cache inode limit.K,MorGsuffix can also be used here ๐งฎ-iโ be intelligent and run only when there was a modification of the disk cache. this option is only possible together with-d๐ง-aโ list the URLs currently stored in the cache. variants of the same URL will be listed once for each variant ๐-Aโ 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 ๐
๐ DELETING A SPECIFIC URL ๐
if htcacheclean is passed one or more URLs, each URL will be deleted from the cache. and if multiple variants of an URL exist, all variants get deleted. bye bestie ๐
when a reverse proxied URL is the one being deleted, the effective URL is constructed from the Host header, the port, the path and the query. and listen โ 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 / from the server localhost, the URL to delete would be:
http://localhost:80/?
๐ LISTING URLS IN THE CACHE ๐
by passing the -a or -A options to htcacheclean, the URLs within the cache will be listed as they are found, one URL per line โจ
the -A option dumps the full cache entry after the URL, with fields in the following order:
- url โ the URL of the entry ๐
- header size โ the size of the header in bytes
- body size โ the size of the body in bytes
- status โ status of the cached response
- entity version โ the number of times this entry has been revalidated without being deleted ๐
- date โ date of the response
- expiry โ expiry date of the response โณ
- request time โ time of the start of the request
- response time โ time of the end of the request
- body present โ if
0, no body is stored with this request,1otherwise - head request โ if
1, the entry contains a cachedHEADrequest with no body,0otherwise
๐ EXIT STATUS ๐
htcacheclean returns a zero status ("true") if all operations were successful, 1 otherwise.
if an URL is specified, and the URL was cached and successfully removed, 0 is returned, 2 otherwise. and if an error occurred during URL removal, 1 is returned ๐ต
๐ FILES ๐
the cache root directory is specified as an argument on the command line and should match the CacheRoot directive in the server configuration.
- path โ the root directory of the disk cache to be cleaned ๐งผ
that's the whole page bestie, you ate it. now go clean that cache ๐โจ
Apache HTTP Server โ 2026-05-08 โ HTCACHECLEAN(8) ๐๐ฆ๐
๐ฆ where this page comes from
- alpine 3.22: apache2-doc 2.4.69-r0 ยท Apache-2.0
- alpine 3.23: apache2-doc 2.4.69-r0 ยท Apache-2.0
- alpine 3.24: apache2-doc 2.4.69-r0 ยท Apache-2.0
- arch rolling: apache 2.4.69-1 ยท Apache-2.0
- debian bookworm: apache2-utils 2.4.68-1~deb12u1 ยท Apache-2.0
- debian trixie: apache2-utils 2.4.68-1~deb13u1 ยท Apache-2.0
- debian trixie: apache2-utils 2.4.69-1~deb13u1 ยท Apache-2.0
- fedora 43: httpd 2.4.68-1.fc43
- fedora 43: httpd 2.4.69-1.fc43 ยท Apache-2.0 AND (BSD-3-Clause AND metamail AND HPND-sell-variant AND Spencer-94)
- fedora 44: httpd 2.4.69-1.fc44 ยท Apache-2.0 AND (BSD-3-Clause AND metamail AND HPND-sell-variant AND Spencer-94)
- nixpkgs unstable: apache-httpd 2.4.69
- ubuntu stonking: apache2-utils 2.4.68-1ubuntu4 ยท Apache-2.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms