mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-15 10:43:30 +01:00
Implement limiting caches (#13605)
* Implement basic expiring cache for LibraryManager * Add expiring cache to more places * Rider why * Make DirectoryService caches static * Use FastConcurrentLru * Reduce default cache size * Simplify DirectoryService caches * Make directory service cache size at least 128
This commit is contained in:
@@ -181,8 +181,8 @@ namespace Jellyfin.Controller.Tests
|
||||
fileSystemMock.Setup(f => f.GetFileSystemInfo(It.Is<string>(x => x == path))).Returns(newFileSystemMetadata);
|
||||
var secondResult = directoryService.GetFile(path);
|
||||
|
||||
Assert.Equal(cachedFileSystemMetadata, result);
|
||||
Assert.Equal(cachedFileSystemMetadata, secondResult);
|
||||
Assert.Equivalent(cachedFileSystemMetadata, result);
|
||||
Assert.Equivalent(cachedFileSystemMetadata, secondResult);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -209,7 +209,7 @@ namespace Jellyfin.Controller.Tests
|
||||
fileSystemMock.Setup(f => f.GetFilePaths(It.Is<string>(x => x == path), false)).Returns(cachedPaths);
|
||||
var directoryService = new DirectoryService(fileSystemMock.Object);
|
||||
|
||||
var result = directoryService.GetFilePaths(path);
|
||||
var result = directoryService.GetFilePaths(path, true);
|
||||
fileSystemMock.Setup(f => f.GetFilePaths(It.Is<string>(x => x == path), false)).Returns(newPaths);
|
||||
var secondResult = directoryService.GetFilePaths(path);
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace Jellyfin.Controller.Tests
|
||||
fileSystemMock.Setup(f => f.GetFilePaths(It.Is<string>(x => x == path), false)).Returns(cachedPaths);
|
||||
var directoryService = new DirectoryService(fileSystemMock.Object);
|
||||
|
||||
var result = directoryService.GetFilePaths(path);
|
||||
var result = directoryService.GetFilePaths(path, true);
|
||||
fileSystemMock.Setup(f => f.GetFilePaths(It.Is<string>(x => x == path), false)).Returns(newPaths);
|
||||
var secondResult = directoryService.GetFilePaths(path, true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user