|
|
@ -38,7 +38,7 @@ public class SteamWebApi { |
|
|
private final HashMap<String, SteamID> steamIdCache = new HashMap<>(); |
|
|
private final HashMap<String, SteamID> steamIdCache = new HashMap<>(); |
|
|
private static final int cache_lifetime = 60 * 60 * 24 * 3; |
|
|
private static final int cache_lifetime = 60 * 60 * 24 * 3; |
|
|
|
|
|
|
|
|
//mojno bilo sdelat 4erez spring cache no ne hochu
|
|
|
//mojno bilo sdelat 4erez spring cache no ne hochu, надо отдельный сервис мутить из-за ебанаых прокси спринга
|
|
|
public SteamData getSteamData(long steam64) { |
|
|
public SteamData getSteamData(long steam64) { |
|
|
if (steamDataCache.containsKey(steam64) && (Instant.now().getEpochSecond() - steamDataCache.get(steam64).getTime() < cache_lifetime)) { |
|
|
if (steamDataCache.containsKey(steam64) && (Instant.now().getEpochSecond() - steamDataCache.get(steam64).getTime() < cache_lifetime)) { |
|
|
return steamDataCache.get(steam64); |
|
|
return steamDataCache.get(steam64); |
|
|
@ -48,7 +48,7 @@ public class SteamWebApi { |
|
|
steamDataCache.put(steam64, result); |
|
|
steamDataCache.put(steam64, result); |
|
|
return result; |
|
|
return result; |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
return steamDataCache.getOrDefault(steam64, null); |
|
|
return steamDataCache.getOrDefault(steam64, new SteamData()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|