From edd3654c0a0d1b8cac3dd77ad3554a32c5b77dfb Mon Sep 17 00:00:00 2001 From: ump45nose <52391318+ump45nose@users.noreply.github.com> Date: Mon, 16 Nov 2026 03:00:00 +0800 Subject: [PATCH] doc/cache: document the cache command (#22139) --- doc/045_working_with_repos.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/045_working_with_repos.rst b/doc/045_working_with_repos.rst index 8adcb5eb6..e126114d1 100644 --- a/doc/045_working_with_repos.rst +++ b/doc/045_working_with_repos.rst @@ -648,3 +648,28 @@ data, you can run ``prune --repack-uncompressed``. When you plan to create your backups with maximum compression, you should also add the ``--compression max`` flag to the prune command. For already backed up data, the compression level cannot be changed later on. + + +Managing local cache directories +================================ + +The ``cache`` command lists the local cache directories and can remove stale +ones: + +.. code-block:: console + + $ restic cache + Repo ID Last Used Old Size + ------------------------------------ + 604bdfd4 2 days ago no 1.5 GiB + ------------------------------------ + 1 cache dirs in /home/user/.cache/restic + +Cache directories that have not been used for 30 days are considered old; the +threshold can be changed with ``--max-age`` (in days). Old cache directories +can be removed using ``restic cache --cleanup``, which honors ``--max-age`` +too. Pass ``--no-size`` to skip computing the size of each cache directory. + +restic also prints a warning at startup when it finds old cache directories, +suggesting ``restic cache --cleanup``. To remove old cache directories +automatically on every restic run, set the global flag ``--cleanup-cache``.