@@ -817,18 +817,6 @@ class HostedSource extends CachedSource {
817817 await _fetchAdvisories (id.toRef (), cache);
818818 }
819819
820- /// An in-memory cache to store the cached version listing loaded from
821- /// [_versionListingCachePath] .
822- ///
823- /// Invariant: Entries in this cache are the parsed version of the exact same
824- /// information cached on disk. I.e. if the entry is present in this cache,
825- /// there will not be a newer version on disk.
826- final Map <PackageRef , (DateTime , List <HostedVersionInfo >)> _responseCache =
827- {};
828-
829- /// An in-memory cache to store the futures of fetched security advisories.
830- final Map <PackageId , Future <List <Advisory >?>> _advisoriesCache = {};
831-
832820 /// If a cached version listing response for [ref] exists on disk and is less
833821 /// than [maxAge] old it is parsed and returned.
834822 ///
@@ -841,7 +829,7 @@ class HostedSource extends CachedSource {
841829 SystemCache cache, {
842830 Duration ? maxAge,
843831 }) async {
844- final cachedInfo = _responseCache[ref];
832+ final cachedInfo = cache.hostedCache. _responseCache[ref];
845833 if (cachedInfo != null ) {
846834 final (cacheTimestamp, versionInfo) = cachedInfo;
847835 final cacheAge = DateTime .now ().difference (cacheTimestamp);
@@ -880,7 +868,7 @@ class HostedSource extends CachedSource {
880868 Uri .file (cachePath),
881869 cache,
882870 );
883- _responseCache[ref] = (parsedTimestamp, res);
871+ cache.hostedCache. _responseCache[ref] = (parsedTimestamp, res);
884872 return res;
885873 }
886874 } on io.IOException {
@@ -932,7 +920,7 @@ class HostedSource extends CachedSource {
932920 );
933921 // Delete the entry in the in-memory cache to maintain the invariant that
934922 // cached information in memory is the same as that on the disk.
935- _responseCache.remove (ref);
923+ cache.hostedCache. _responseCache.remove (ref);
936924 } on io.IOException catch (e) {
937925 // Not being able to write this cache is not fatal. Just move on...
938926 log.fine ('Failed writing cache file. $e ' );
@@ -1098,7 +1086,7 @@ class HostedSource extends CachedSource {
10981086 SystemCache cache,
10991087 Duration ? maxAge,
11001088 ) {
1101- return _advisoriesCache.putIfAbsent (
1089+ return cache.hostedCache. _advisoriesCache.putIfAbsent (
11021090 id,
11031091 () => _getAdvisories (id, cache, maxAge),
11041092 );
@@ -2192,6 +2180,18 @@ final class HostedSourceCache {
21922180 final RateLimitedScheduler <HostedRefAndCache , List <HostedVersionInfo >>
21932181 scheduler;
21942182
2183+ /// An in-memory cache to store the cached version listing loaded from
2184+ /// [_versionListingCachePath] .
2185+ ///
2186+ /// Invariant: Entries in this cache are the parsed version of the exact same
2187+ /// information cached on disk. I.e. if the entry is present in this cache,
2188+ /// there will not be a newer version on disk.
2189+ final Map <PackageRef , (DateTime , List <HostedVersionInfo >)> _responseCache =
2190+ {};
2191+
2192+ /// An in-memory cache to store the futures of fetched security advisories.
2193+ final Map <PackageId , Future <List <Advisory >?>> _advisoriesCache = {};
2194+
21952195 HostedSourceCache (HostedSource hosted)
21962196 : scheduler = RateLimitedScheduler (
21972197 (HostedRefAndCache refAndCache) => hosted.fetchVersions (refAndCache),
0 commit comments