diff --git a/Jellyfin.Plugin.Tvdb/ScheduledTasks/PurgeCacheTask.cs b/Jellyfin.Plugin.Tvdb/ScheduledTasks/PurgeCacheTask.cs deleted file mode 100644 index f949c4f..0000000 --- a/Jellyfin.Plugin.Tvdb/ScheduledTasks/PurgeCacheTask.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Model.Tasks; -using Microsoft.Extensions.Logging; - -namespace Jellyfin.Plugin.Tvdb.ScheduledTasks -{ - /// - /// Task to purge TheTVDB plugin cache. - /// - public class PurgeCacheTask : IScheduledTask - { - private readonly ILogger _logger; - private readonly TvdbClientManager _tvdbClientManager; - - /// - /// Initializes a new instance of the class. - /// - /// Instance of the interface. - /// Instance of . - public PurgeCacheTask( - ILogger logger, - TvdbClientManager tvdbClientManager) - { - _logger = logger; - _tvdbClientManager = tvdbClientManager; - } - - /// - public string Name => "Purge TheTVDB plugin cache"; - - /// - public string Key => "PurgeTheTVDBPluginCache"; - - /// - public string Description => "Purges the TheTVDB Cache"; - - /// - public string Category => "TheTVDB"; - - /// - public Task ExecuteAsync(IProgress progress, CancellationToken cancellationToken) - { - if (_tvdbClientManager.PurgeCache()) - { - _logger.LogInformation("TheTvdb plugin cache purged successfully"); - } - else - { - _logger.LogError("TheTvdb plugin cache purge failed"); - } - - return Task.CompletedTask; - } - - /// - public IEnumerable GetDefaultTriggers() - { - return Enumerable.Empty(); - } - } -} diff --git a/Jellyfin.Plugin.Tvdb/TvdbClientManager.cs b/Jellyfin.Plugin.Tvdb/TvdbClientManager.cs index 0853e0d..3865b83 100644 --- a/Jellyfin.Plugin.Tvdb/TvdbClientManager.cs +++ b/Jellyfin.Plugin.Tvdb/TvdbClientManager.cs @@ -501,23 +501,6 @@ public async Task> GetArtworkTypeAsync(CancellationTo } } - /// - /// Purge the cache. - /// - /// True if success else false. - public bool PurgeCache() - { - if (_memoryCache is MemoryCache memoryCache) - { - memoryCache.Compact(1); - return true; - } - else - { - return false; - } - } - /// /// Create an independent ServiceProvider because registering HttpClients directly into Jellyfin /// causes issues upstream.