From 40b0cdffc30418bf9fa56546cf02e12fd7edc8bb Mon Sep 17 00:00:00 2001 From: flightlevel Date: Sun, 14 Apr 2019 11:59:48 +1000 Subject: [PATCH] Reduce cache size --- src/Jackett.Common/Services/CacheService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Jackett.Common/Services/CacheService.cs b/src/Jackett.Common/Services/CacheService.cs index ea26e3abb..b1c030b1a 100644 --- a/src/Jackett.Common/Services/CacheService.cs +++ b/src/Jackett.Common/Services/CacheService.cs @@ -13,7 +13,7 @@ namespace Jackett.Common.Services { private readonly List cache = new List(); private readonly int MAX_RESULTS_PER_TRACKER = 1000; - private readonly TimeSpan AGE_LIMIT = new TimeSpan(7, 0, 0, 0); + private readonly TimeSpan AGE_LIMIT = new TimeSpan(0, 1, 0, 0); public void CacheRssResults(IIndexer indexer, IEnumerable releases) { @@ -44,7 +44,7 @@ namespace Jackett.Common.Services // Prune cache foreach(var tracker in cache) { - tracker.Results = tracker.Results.OrderByDescending(i => i.Created).Take(MAX_RESULTS_PER_TRACKER).ToList(); + tracker.Results = tracker.Results.Where(x => x.Created > DateTime.Now.Subtract(AGE_LIMIT)).OrderByDescending(i => i.Created).Take(MAX_RESULTS_PER_TRACKER).ToList(); } } }