mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-23 09:14:45 +03:00
update based on suggestions
This commit is contained in:
@@ -25,7 +25,7 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
|
|
||||||
public FileSystemMetadata[] GetFileSystemEntries(string path)
|
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)
|
public List<FileSystemMetadata> GetFiles(string path)
|
||||||
@@ -45,7 +45,7 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
|
|
||||||
public FileSystemMetadata GetFile(string path)
|
public FileSystemMetadata GetFile(string path)
|
||||||
{
|
{
|
||||||
var result = _fileCache.GetOrAdd(path, (p) =>
|
var result = _fileCache.GetOrAdd(path, p =>
|
||||||
{
|
{
|
||||||
var file = _fileSystem.GetFileInfo(path);
|
var file = _fileSystem.GetFileInfo(path);
|
||||||
return (file != null && file.Exists) ? file : null;
|
return (file != null && file.Exists) ? file : null;
|
||||||
@@ -54,7 +54,7 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
// lets not store null results in the cache
|
// lets not store null results in the cache
|
||||||
_fileCache.TryRemove(path, out FileSystemMetadata removed);
|
_fileCache.TryRemove(path, out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -67,10 +67,10 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
{
|
{
|
||||||
if (clearCache)
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user