perf: dandan api speed limit

This commit is contained in:
cxfksword
2025-05-10 11:04:02 +08:00
parent 647e583add
commit 164c38fb0f

View File

@@ -80,7 +80,7 @@ public class DandanApi : AbstractApi
}
var cacheKey = $"search_{keyword}";
var expiredOption = new MemoryCacheEntryOptions() { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(5) };
var expiredOption = new MemoryCacheEntryOptions() { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(30) };
if (_memoryCache.TryGetValue<List<Anime>>(cacheKey, out var searchResult))
{
return searchResult;
@@ -219,6 +219,8 @@ public class DandanApi : AbstractApi
throw new ArgumentNullException(nameof(epId));
}
this.LimitRequestFrequently();
var withRelated = this.Config.WithRelatedDanmu ? "true" : "false";
var chConvert = this.Config.ChConvert;
var url = $"https://api.dandanplay.net/api/v2/comment/{epId}?withRelated={withRelated}&chConvert={chConvert}";