aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2021-08-13 17:56:39 +0200
committerGitHub <noreply@github.com>2021-08-13 17:56:39 +0200
commitd639b030ac6d6099ecd36eebc19ccd2fb6075b0a (patch)
treef8f44e1f997b54c78b37e713ab5615a5839af412 /MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
parente33901b9f5f65eb8e48c018a30a37094ad874897 (diff)
parentcb990ae97313507fc26384d395c22dd3b253ef31 (diff)
Merge pull request #6335 from richlander/media-provides-analysis-fixes
Diffstat (limited to 'MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs')
-rw-r--r--MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs22
1 files changed, 21 insertions, 1 deletions
diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
index 3980b7da0..4de4bf4db 100644
--- a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
+++ b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
@@ -18,7 +18,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
/// <summary>
/// Manager class for abstracting the TMDb API client library.
/// </summary>
- public class TmdbClientManager
+ public class TmdbClientManager : IDisposable
{
private const int CacheDurationInHours = 1;
@@ -532,5 +532,25 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
{
return !_tmDbClient.HasConfig ? _tmDbClient.GetConfigAsync() : Task.CompletedTask;
}
+
+ /// <inheritdoc />
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+/// <summary>
+ /// Releases unmanaged and - optionally - managed resources.
+ /// </summary>
+ /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ _memoryCache?.Dispose();
+ _tmDbClient?.Dispose();
+ }
+ }
}
}