public SmallFileBlockStream OpenReadCachedOnly(FSItem item, Downloader downloader = null) { CacheEntry entry; var path = Path.Combine(cachePath, item.Id); if (!File.Exists(path)) { if (access.TryRemove(item.Id, out entry)) { TotalSizeDecrease(item.Length); } return(null); } if (access.TryGetValue(item.Id, out entry)) { entry.AccessTime = DateTime.UtcNow; } else { AddExisting(item); } Log.Trace("Opened cached: " + item.Id); return(SmallFileBlockStream.OpenReadonly(item, path, downloader)); }
public SmallFileBlockStream OpenReadCachedOnly(FSItem item, Downloader downloader = null) { var path = GetFilePath(item); if (path == null) { return(null); } Log.Trace("Opened cached: " + item.Id); return(SmallFileBlockStream.OpenReadonly(item, path, downloader)); }