Skip to content

A better cache clean-up and expiration policy #4980

@terrajobst

Description

@terrajobst

edit by @zivkan: a first step has been implemented, allowing package "last used in restore" date to be updated: NuGet/NuGet.Client#4222

edit by NuGet Client Triage:

  • Restore driven - A minimally impactful approach might be to run a "gc" periodically, like say once a week or once a month.
  • Additional command - Community projects like NuGet Cleaner combine with updatePackageLastAccessTime

original post below:


The user local NuGet cache has a tendency to grow unconditionally. Which results in funny tweets like this from @davidfowl:

David Fowler@davidfowl 9m
How big is your nuget cache? Mine is 14 gigs #nuget
image

Can we track when an item was last hit by package restore and apply some expiration policy? I don't have good data, but I bet a good chunk of the bloat aren't individual packages with a single version but a small number of packages with many versions. If were to just delete older versions that weren't needed for restore for a while, we're probably getting to something saner.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area:HttpCachinghttp caching by all toolsCategory:Quality WeekIssues that should be considered for quality weekPriority:2Issues for the current backlog.Type:Featurehelp wantedConsidered good issues for community contributions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions