private async Task RefreshCacheAsync(ClientStorageContext context) { IAsyncEnumerable <Client> entities = context.GetAllBlobEntitiesAsync <Entities.Client>(context.ClientBlobContainer, _logger); (string blobName, int count) = await context.UpdateBlobCacheFileAsync <Entities.Client>(entities, context.ClientCacheBlobContainer); _logger.LogInformation($"{nameof(RefreshCacheAsync)} client count {count} saved in blob storage: {blobName}"); await context.DeleteBlobCacheFilesAsync(blobName, context.ClientCacheBlobContainer, _logger); }
/// <summary> /// Method to refresh cache /// </summary> /// <returns></returns> public async Task RefreshCacheAsync() { try { _logger.LogTrace($"Querying for {nameof(ClientStorageContext)} cache refresh"); ClientStorageContext context = _serviceProvider.CreateScope().ServiceProvider.GetService <ClientStorageContext>(); await RefreshCacheAsync(context); } catch (Exception ex) { _logger.LogError("Exception refreshing client blob cache: {exception}", ex.Message); } }
public ClientStore(ClientStorageContext storageContext, ILogger <ClientStore> logger) { StorageContext = storageContext; _logger = logger; }