From 4c83e916cd999c420735031cdb6d847abad73f61 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Tue, 22 Nov 2022 10:33:23 +0000 Subject: [PATCH] Remove downloader caching. --- .../me/kavin/piped/utils/DownloaderImpl.java | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/main/java/me/kavin/piped/utils/DownloaderImpl.java b/src/main/java/me/kavin/piped/utils/DownloaderImpl.java index c850a1c..fd65c51 100644 --- a/src/main/java/me/kavin/piped/utils/DownloaderImpl.java +++ b/src/main/java/me/kavin/piped/utils/DownloaderImpl.java @@ -1,15 +1,11 @@ package me.kavin.piped.utils; -import com.github.benmanes.caffeine.cache.AsyncLoadingCache; -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.Scheduler; import com.grack.nanojson.JsonParserException; import me.kavin.piped.consts.Constants; import me.kavin.piped.utils.obj.SolvedCaptcha; import okhttp3.FormBody; import okhttp3.RequestBody; import org.apache.commons.lang3.StringUtils; -import org.jetbrains.annotations.NotNull; import org.jsoup.Jsoup; import org.jsoup.nodes.Element; import org.schabi.newpipe.extractor.downloader.Downloader; @@ -27,25 +23,11 @@ public class DownloaderImpl extends Downloader { private static long cookie_received; private static final Object cookie_lock = new Object(); - final AsyncLoadingCache responseCache = Caffeine.newBuilder() - .expireAfterWrite(1, TimeUnit.MINUTES) - .scheduler(Scheduler.systemScheduler()) - .executor(Multithreading.getCachedExecutor()) - .maximumSize(100).buildAsync(this::executeRequest); - - @Override - public Response execute(@NotNull Request request) { - try { - return responseCache.get(request).get(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - /** * Executes a request with HTTP/2. */ - public Response executeRequest(Request request) throws IOException, ReCaptchaException { + @Override + public Response execute(Request request) throws IOException, ReCaptchaException { // TODO: HTTP/3 aka QUIC var bytes = request.dataToSend();