AnalyzerCacheGarbageCollector class

Opt-in garbage collector for orphaned analyzer-cache partitions.

Operates at the analyzer-cache root (the parent of the per-toolchain <major>/<sdk> partitions), so it can enumerate and prune sibling partitions the running toolchain does not use.

Constructors

AnalyzerCacheGarbageCollector(String cacheRoot)
Creates a collector rooted at an explicit analyzer-cache directory.
AnalyzerCacheGarbageCollector.resolve({String? startDirectory, Map<String, String>? environment})
Resolves the shared analyzer-cache root via ToolCacheLocator.
factory

Properties

cacheRoot String
The analyzer-cache root directory holding <major>/<sdk> partitions.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

collect({required DateTime cutoff, Set<String> keep = const {}, bool dryRun = false}) Future<List<AnalyzerCachePartition>>
Deletes partitions last used before cutoff, returning those removed.
listPartitions() Future<List<AnalyzerCachePartition>>
Enumerates all <major>/<sdk> partitions under cacheRoot.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

currentPartitionKey({int? analyzerMajor, String? dartSdkVersion}) String
The "<analyzer-major>/<dart-sdk-version>" key of the partition the current toolchain uses.
selectForCollection(List<AnalyzerCachePartition> partitions, {required DateTime cutoff, Set<String> keep = const {}}) List<AnalyzerCachePartition>
Pure selection of the partitions eligible for collection.