From 268d88a5fb8f0f71c96ba5abcef250d1f7e049ff Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Sat, 7 Feb 2026 00:56:55 +0100 Subject: Optimize Collection Grouping, NextUp and Latest queries --- MediaBrowser.Controller/Library/ILibraryManager.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'MediaBrowser.Controller/Library') diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 9b46dec3fe..3b3295c57d 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -697,6 +697,15 @@ namespace MediaBrowser.Controller.Library /// Dictionary mapping parent ID to child count. Dictionary GetChildCountBatch(IReadOnlyList parentIds, Guid? userId); + /// + /// Batch-fetches played and total counts for multiple folder items. + /// Avoids N+1 queries when building DTOs for lists of folder items. + /// + /// The list of folder item IDs. + /// The user for access filtering and played status. + /// Dictionary mapping folder ID to (Played count, Total count). + Dictionary GetPlayedAndTotalCountBatch(IReadOnlyList folderIds, User user); + /// /// Configures the query with user access settings including TopParentIds for library access. /// Call this before passing a query to methods that need user access filtering. -- cgit v1.2.3