Ad LRU to ImageCache to get a handle on memory bloat

This commit is contained in:
tehdiplomat
2019-02-26 14:42:58 -05:00
parent 3095c25f6d
commit f0efc2089c
3 changed files with 32 additions and 26 deletions

View File

@@ -70,6 +70,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_OVERLAY_CARD_MANA_COST ("true"),
UI_OVERLAY_CARD_ID ("true"),
UI_ENABLE_ONLINE_IMAGE_FETCHER ("false"),
UI_IMAGE_CACHE_MAXIMUM("400"),
UI_OVERLAY_FOIL_EFFECT ("true"),
UI_HIDE_REMINDER_TEXT ("false"),
UI_OPEN_PACKS_INDIV ("false"),
@@ -125,7 +126,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_DISABLE_IMAGES_EFFECT_CARDS("false"),
UI_ALLOW_ORDER_GRAVEYARD_WHEN_NEEDED ("Never"),
UI_DEFAULT_FONT_SIZE("12"),
UI_SELECT_FROM_CARD_DISPLAYS("true"),
UI_SELECT_FROM_CARD_DISPLAYS("true"),
UI_FOR_TOUCHSCREN("false"),
UI_VIBRATE_ON_LIFE_LOSS("true"),

View File

@@ -17,6 +17,8 @@
*/
package forge.properties;
import forge.util.FileUtil;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
@@ -24,8 +26,6 @@ import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import forge.util.FileUtil;
/**
* Holds default preference values in an enum.
* Loads preferred values when instantiated.
@@ -109,7 +109,11 @@ public abstract class PreferencesStore<T extends Enum<T>> {
}
public final int getPrefInt(final T fp0) {
return Integer.parseInt(getPref(fp0));
try{
return Integer.parseInt(getPref(fp0));
} catch(NumberFormatException e) {
return Integer.parseInt(getPrefDefault(fp0));
}
}
public final boolean getPrefBoolean(final T fp0) {