update based on suggestions

This commit is contained in:
Gary Wilber 2020-09-27 17:24:12 -07:00
parent 89041982c2
commit 449f7e1b1e

View File

@ -25,7 +25,7 @@ namespace MediaBrowser.Controller.Providers
public FileSystemMetadata[] GetFileSystemEntries(string path)
{
return _cache.GetOrAdd(path, (p) => _fileSystem.GetFileSystemEntries(p).ToArray());
return _cache.GetOrAdd(path, p => _fileSystem.GetFileSystemEntries(p).ToArray());
}
public List<FileSystemMetadata> GetFiles(string path)
@ -45,7 +45,7 @@ namespace MediaBrowser.Controller.Providers
public FileSystemMetadata GetFile(string path)
{
var result = _fileCache.GetOrAdd(path, (p) =>
var result = _fileCache.GetOrAdd(path, p =>
{
var file = _fileSystem.GetFileInfo(path);
return (file != null && file.Exists) ? file : null;
@ -54,7 +54,7 @@ namespace MediaBrowser.Controller.Providers
if (result == null)
{
// lets not store null results in the cache
_fileCache.TryRemove(path, out FileSystemMetadata removed);
_fileCache.TryRemove(path, out _);
}
return result;
@ -67,10 +67,10 @@ namespace MediaBrowser.Controller.Providers
{
if (clearCache)
{
_filePathCache.TryRemove(path, out List<string> removed);
_filePathCache.TryRemove(path, out _);
}
return _filePathCache.GetOrAdd(path, (p) => _fileSystem.GetFilePaths(path).ToList());
return _filePathCache.GetOrAdd(path, p => _fileSystem.GetFilePaths(path).ToList());
}
}
}