Subject: [bug#45327] [PATCH] git: Periodically delete least-recently-used cached checkouts.

From: Guillaume Le Vaillant <[email-masked]>
Date: Sun, 20 Dec 2020 15:16:22 +0100

Ludovic Courtès <[email-masked]> skribis:

> Hi,
>
> Guillaume Le Vaillant <[email-masked]> skribis:
>
>> Ludovic Courtès <[email-masked]> skribis:
>>
>>> Hi!
>>>
>>> I noticed that my ~/.cache/guix/checkouts directory had accumulated
>>> a lot of cruft from channels, playing with ‘--with-branch’ and such,
>>> and that it would be nice to clean it up once in a while.
>>>
>>> This is what this patch does.  It uses the (guix cache) default
>>> strategy, which consists in deleting least-recently-used items by
>>> looking at their atime.
>>>
>>> Thoughts?
>>
>> How does it behave when the cache is on a file system mounted with the
>> 'noatime' option?
>
> I guess the worst that could happen is that checkouts are removed too
> frequently (because the atime is not updated), meaning that users find
> themselves making full clones more often than we’d like.
>
> Perhaps we could use the mtime instead, since when checkouts are
> updated, the mtime is presumably updated too.
>
> Thoughts?
>
> Ludo’.

I guess either using mtime or making Guix update the atime when using
a cached checkout would work.