Remove cache

This commit is contained in:
Minecon724 2024-10-27 15:09:29 +01:00
parent 06ce165bf8
commit da5d87656f
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8

View file

@ -1,17 +1,15 @@
package eu.m724.jarupdater.live;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import eu.m724.jarupdater.environment.Environment;
import eu.m724.jarupdater.object.Version;
import java.util.List;
import java.util.concurrent.CompletableFuture;
public class MetadataFacade {
private final Environment environment;
private final MetadataDAO metadataDao;
private final HashMap<String, CompletableFuture<Version>> cache = new HashMap<>();
private CompletableFuture<List<String>> channels = null;
public MetadataFacade(Environment environment, MetadataDAO metadataDao) {
@ -35,13 +33,7 @@ public class MetadataFacade {
}
public CompletableFuture<Version> getVersionMetadata(String version, boolean ignoreCache) {
if (!ignoreCache && cache.containsKey(version))
return cache.get(version);
CompletableFuture<Version> future = metadataDao.getMetadata(environment.getChannel(), version);
cache.put(version, future); // TODO should we cache forever?
return future;
return metadataDao.getMetadata(environment.getChannel(), version);
}
public CompletableFuture<Version> getVersionMetadata(String version) {