/// <summary>
        /// Flush All Cached Item async.
        /// </summary>
        /// <returns>The async.</returns>
        public async Task FlushAsync()
        {
            await _localCachingProvider.FlushAsync();

            try
            {
                await _distributedCachingProvider.FlushAsync();
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.Message);
            }
        }
Example #2
0
        protected virtual async Task FlushAsync_Should_Succeed()
        {
            for (var i = 0; i < 5; i++)
            {
                _provider.Set($"flush:{i}", $"value{i}", _defaultTs);
            }

            for (var i = 0; i < 5; i++)
            {
                Assert.Equal($"value{i}", _provider.Get <string>($"flush:{i}").Value);
            }

            await _provider.FlushAsync();

            for (var i = 0; i < 5; i++)
            {
                Assert.False(_provider.Get <string>($"flush:{i}").HasValue);
            }
        }
Example #3
0
 /// <summary>
 /// Clear all cache
 /// </summary>
 public async Task ClearAsync()
 {
     await _provider.FlushAsync();
 }
Example #4
0
 public Task Clear() => _provider.FlushAsync();
Example #5
0
 /// <summary>
 /// Flush All Cached Item async.
 /// </summary>
 /// <param name="cancellationToken">cancellationToken</param>
 /// <returns>Task</returns>
 public Task FlushAsync(CancellationToken cancellationToken = default)
 {
     return(_easyCachingProvider.FlushAsync());
 }
Example #6
0
 public Task ClearAsync()
 {
     return(_provider.FlushAsync());
 }