Skip to content

Commit

Permalink
re-arranged the FC constructor so that cleaning check occurs after Ca…
Browse files Browse the repository at this point in the history
…cheManager construction (prevents runtime exception, addresses #42)
  • Loading branch information
acarteas committed Sep 17, 2020
1 parent 73b0d5b commit b077b19
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/FileCache/FileCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,14 @@ private void Init(
_cleanInterval = cleanInterval;
}

//set up cache manager
CacheManager = FileCacheManagerFactory.Create(manager);
CacheManager.CacheDir = CacheDir;
CacheManager.CacheSubFolder = _cacheSubFolder;
CacheManager.PolicySubFolder = _policySubFolder;
CacheManager.Binder = _binder;
CacheManager.AccessTimeout = new TimeSpan();

//check to see if cache is in need of immediate cleaning
if (ShouldClean())
{
Expand All @@ -353,14 +361,6 @@ private void Init(
UpdateCacheSizeAsync();
}

//set up cache manager
CacheManager = FileCacheManagerFactory.Create(manager);
CacheManager.CacheDir = CacheDir;
CacheManager.CacheSubFolder = _cacheSubFolder;
CacheManager.PolicySubFolder = _policySubFolder;
CacheManager.Binder = _binder;
CacheManager.AccessTimeout = new TimeSpan();

MaxCacheSizeReached += FileCache_MaxCacheSizeReached;
}

Expand Down

0 comments on commit b077b19

Please sign in to comment.