Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java	(revision 12254)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java	(revision 12255)
@@ -50,10 +50,4 @@
   protected Collection<Way> ways = new ArrayList<Way>();
 
-  /** maximum size in bytes for the sum of all tiles in a WMS-layer cache directory. */
-  private static final long MAXCACHESIZE = 20*1024*1024*1024;
-
-  /** maximum age in ms since epoch for tiles in a WMS-layer cache directory. */
-  private static final long MAXCACHEAGE = 3650*24*60*60*1000;
-  
   public LakewalkerAction(String name) {
     super(name, "lakewalker-sml", tr("Lake Walker."),
@@ -100,4 +94,6 @@
    */
   private void cleanupCache() {
+	  final long maxCacheAge = System.currentTimeMillis()-Main.pref.getInteger(LakewalkerPreferences.PREF_MAXCACHEAGE, 100)*24*60*60*1000L;
+	  final long maxCacheSize = Main.pref.getInteger(LakewalkerPreferences.PREF_MAXCACHESIZE, 300)*1024*1024;
 
 	  for (String wmsFolder : LakewalkerPreferences.WMSLAYERS) {
@@ -117,5 +113,4 @@
 			  // delete aged or oversized, keep newest. Once size/age limit was reached delete all older files
 			  long folderSize = 0;
-			  long timeDefiningOverage = System.currentTimeMillis()-MAXCACHEAGE;
 			  boolean quickdelete = false;
 			  for (File cacheEntry : wmsCache) {
@@ -123,7 +118,7 @@
 				  if (!quickdelete) {
 					  folderSize += cacheEntry.length();
-					  if (folderSize > MAXCACHESIZE) {
+					  if (folderSize > maxCacheSize) {
 						  quickdelete = true;
-					  } else if (cacheEntry.lastModified() < timeDefiningOverage) {
+					  } else if (cacheEntry.lastModified() < maxCacheAge) {
 						  quickdelete = true;
 					  }
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java	(revision 12254)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java	(revision 12255)
@@ -3,8 +3,6 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.MainMenu;
 import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
 import org.openstreetmap.josm.plugins.Plugin;
@@ -17,5 +15,5 @@
 public class LakewalkerPlugin extends Plugin {
   public LakewalkerPlugin() {
-    Main.main.menu.add(Main.main.menu.toolsMenu, new LakewalkerAction(tr("Lake Walker")));
+    MainMenu.add(Main.main.menu.toolsMenu, new LakewalkerAction(tr("Lake Walker")));
   }
 
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java	(revision 12254)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java	(revision 12255)
@@ -3,4 +3,5 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import javax.swing.Box;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
@@ -29,4 +30,6 @@
   public static final String PREF_WAYTYPE = "lakewalker.waytype";
   public static final String PREF_WMS = "lakewalker.wms";
+  public static final String PREF_MAXCACHESIZE = "lakewalker.maxcachesize";
+  public static final String PREF_MAXCACHEAGE = "lakewalker.maxcacheage";
     
   protected IntConfigurer maxSegsConfig = new IntConfigurer();
@@ -52,4 +55,8 @@
   protected StringEnumConfigurer wmsConfig = new StringEnumConfigurer(WMSLAYERS);
   protected JLabel wmsLabel = new JLabel(tr("WMS Layer"));
+  protected IntConfigurer maxCacheSizeConfig = new IntConfigurer();
+  protected JLabel maxCacheSizeLabel = new JLabel(tr("Maximum cache size (MB)"));
+  protected IntConfigurer maxCacheAgeConfig = new IntConfigurer();
+  protected JLabel maxCacheAgeLabel = new JLabel(tr("Maximum cache age (days)"));
   
   public void addGui(PreferenceDialog gui) {
@@ -65,5 +72,7 @@
     lakeTypeConfig.setToolTipText(tr("Tag ways as water, coastline, land or nothing. Default is water."));
     wmsConfig.setToolTipText(tr("Which WMS layer to use for tracing against. Default is IR1."));
-
+    maxCacheSizeConfig.setToolTipText(tr("Maximum size of each cache directory in bytes. Default is 300MB"));
+    maxCacheAgeConfig.setToolTipText(tr("Maximum age of each cached file in days. Default is 100"));
+    
     String description = tr("An plugin to trace water bodies on Landsat imagery.");
     JPanel prefPanel = gui.createPreferenceTab("lakewalker.png", I18n.tr("Lakewalker Plugin Preferences"), description);
@@ -81,4 +90,6 @@
     lakeTypeConfig.setValue(Main.pref.get(PREF_WAYTYPE, "water"));
     wmsConfig.setValue(Main.pref.get(PREF_WMS, "IR1"));
+    maxCacheSizeConfig.setValue(Main.pref.getInteger(PREF_MAXCACHESIZE, 300));
+    maxCacheAgeConfig.setValue(Main.pref.getInteger(PREF_MAXCACHEAGE, 100));
   }
   
@@ -109,4 +120,11 @@
     prefPanel.add(wmsLabel, labelConstraints);
     prefPanel.add(wmsConfig.getControls(), dataConstraints);
+    prefPanel.add(maxCacheSizeLabel, labelConstraints);
+    prefPanel.add(maxCacheSizeConfig.getControls(), dataConstraints);
+    prefPanel.add(maxCacheAgeLabel, labelConstraints);
+    prefPanel.add(maxCacheAgeConfig.getControls(), dataConstraints);
+
+    prefPanel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL));
+
   }
 
@@ -126,4 +144,6 @@
     Main.pref.put(PREF_WAYTYPE, lakeTypeConfig.getValueString());
     Main.pref.put(PREF_WMS, wmsConfig.getValueString());
+    Main.pref.put(PREF_MAXCACHESIZE, maxCacheSizeConfig.getValueString());
+    Main.pref.put(PREF_MAXCACHEAGE, maxCacheAgeConfig.getValueString());
   }
   
