protected virtual async Task <IList <ImageChange> > GetChangeFiles(ThumbnailTask task, DateTime?changedSince, ICancellationToken token) { var options = await GetOptionsCollection(); var cacheKey = CacheKey.With(GetType(), "GetChangeFiles", task.WorkPath, changedSince?.ToString(), string.Join(":", options.Select(x => x.FileSuffix))); return(await _platformMemoryCache.GetOrCreateExclusiveAsync(cacheKey, async (cacheEntry) => { cacheEntry.AddExpirationToken(BlobChangesCacheRegion.CreateChangeToken(task, changedSince)); var allBlobInfos = await ReadBlobFolderAsync(task.WorkPath, token); var orignalBlobInfos = GetOriginalItems(allBlobInfos, options.Select(x => x.FileSuffix).ToList()); var result = new List <ImageChange>(); foreach (var blobInfo in orignalBlobInfos) { token?.ThrowIfCancellationRequested(); var imageChange = new ImageChange { Name = blobInfo.Name, Url = blobInfo.Url, ModifiedDate = blobInfo.ModifiedDate, ChangeState = !changedSince.HasValue ? EntryState.Added : GetItemState(blobInfo, changedSince, task.ThumbnailOptions) }; result.Add(imageChange); } return result.Where(x => x.ChangeState != EntryState.Unchanged).ToList(); })); }
private void ClearCache(ThumbnailTask task, bool regenerate) { BlobChangesCacheRegion.ExpireTaskRun(task, GetChangesSinceDate(task, regenerate)); }