Go to main content

man pages section 8: System Administration Commands

Exit Print View

Updated: Wednesday, July 27, 2022

htcacheclean (8)


htcacheclean - Clean up the disk cache


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


HTCACHECLEAN(8)                  htcacheclean                  HTCACHECLEAN(8)

       htcacheclean - Clean up the disk cache

       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

       htcacheclean  is  used  to  keep  the  size of mod_cache_disk'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.

              Daemonize and repeat cache cleaning every interval minutes. This
              option is mutually exclusive with the -D, -v and -r options.  To
              shutdown the daemon cleanly, just send it a SIGTERM or SIGINT.

       -D     Do  a dry run and don't delete anything. This option is mutually
              exclusive with the -d option. When doing a dry run and  deleting
              directories  with  -t,  the inodes reported deleted in the stats
              cannot take into account the directories deleted,  and  will  be
              marked as an estimate.

       -v     Be  verbose and print statistics. This option is mutually exclu-
              sive with the -d option.

       -r     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 -d option and implies  the
              -t option.

       -n     Be  nice.  This causes slower processing in favour of other pro-
              cesses. htcacheclean 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.

       -t     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.

       -ppath Specify  path  as  the  root  directory  of the disk cache. This
              should be the same value as specified with the CacheRoot  direc-

              Specify  pidfile as the name of the file to write the process ID
              to when daemonized.

              Specify round as the amount to round sizes up to, to  compensate
              for  disk block sizes. Set to the block size of the cache parti-

              Specify limit as the total disk cache size limit. The  value  is
              expressed  in  bytes  by default (or attaching B to the number).
              Attach K for Kbytes, M for MBytes or G for Gbytes.

              Specify limit as the total disk cache inode limit.  K,  M  or  G
              suffix can also be used.

       -i     Be intelligent and run only when there was a modification of the
              disk cache. This option is only possible together  with  the  -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.

       If  htcacheclean  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.

       When  a reverse proxied URL is to be deleted, the effective URL is con-
       structed from the Host header, the port, the path and the  query.  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  /
       from  the  server  localhost,  the URL to delete would be http://local-

       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

       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, 1 otherwise.

       head request
              If 1, the entry contains a cached HEAD request with no  body,  0

       htcacheclean returns a zero status ("true") if all operations were suc-
       cessful, 1 otherwise. If an URL is specified, and the  URL  was  cached
       and  successfully  removed,  0  is  returned,  2 otherwise. If an error
       occurred during URL removal, 1 is returned.

       See attributes(7) for descriptions of the following attributes:

       |Availability   | web/server/apache-24 |
       |Stability      | Uncommitted          |

       Source code for open source software components in Oracle  Solaris  can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-

       This    software    was    built    from    source     available     at
       https://github.com/oracle/solaris-userland.    The  original  community
       source         was         downloaded         from          https://ar-

       Further information about this software can be found on the open source
       community website at https://httpd.apache.org/.

Apache HTTP Server                2019-08-09                   HTCACHECLEAN(8)