diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-02-07 00:56:55 +0100 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-02-07 01:38:06 +0100 |
| commit | 268d88a5fb8f0f71c96ba5abcef250d1f7e049ff (patch) | |
| tree | dbca9e0725ed368f8621901b96a1f1a5846c500a /MediaBrowser.Controller/Library | |
| parent | 8ddc35a1ced32b40ef2ee333f2adcc57f3725811 (diff) | |
Optimize Collection Grouping, NextUp and Latest queries
Diffstat (limited to 'MediaBrowser.Controller/Library')
| -rw-r--r-- | MediaBrowser.Controller/Library/ILibraryManager.cs | 9 |
1 files changed, 9 insertions, 0 deletions
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 @@ -698,6 +698,15 @@ namespace MediaBrowser.Controller.Library Dictionary<Guid, int> GetChildCountBatch(IReadOnlyList<Guid> parentIds, Guid? userId); /// <summary> + /// Batch-fetches played and total counts for multiple folder items. + /// Avoids N+1 queries when building DTOs for lists of folder items. + /// </summary> + /// <param name="folderIds">The list of folder item IDs.</param> + /// <param name="user">The user for access filtering and played status.</param> + /// <returns>Dictionary mapping folder ID to (Played count, Total count).</returns> + Dictionary<Guid, (int Played, int Total)> GetPlayedAndTotalCountBatch(IReadOnlyList<Guid> folderIds, User user); + + /// <summary> /// 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. /// </summary> |
