/// <summary> /// Initializes with default values if user has not initialized explicitly /// </summary> /// <returns>awaitable task</returns> private async Task ForceInitialiseAsync() { if (_cacheFolder != null) { return; } await _cacheFolderSemaphore.WaitAsync().ConfigureAwait(false); _inMemoryFileStorage = new InMemoryStorage <T>(); if (_baseFolder == null) { _baseFolder = ApplicationData.Current.TemporaryFolder; } if (string.IsNullOrWhiteSpace(_cacheFolderName)) { _cacheFolderName = GetType().Name; } try { _cacheFolder = await _baseFolder.CreateFolderAsync(_cacheFolderName, CreationCollisionOption.OpenIfExists).AsTask().ConfigureAwait(false); } finally { _cacheFolderSemaphore.Release(); } }
/// <summary> /// Initializes a new instance of the <see cref="CacheBase{T}"/> class. /// </summary> protected CacheBase() { CacheDuration = TimeSpan.FromDays(1); _inMemoryFileStorage = new InMemoryStorage <T>(); RetryCount = 1; }