Index: trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java	(revision 10416)
+++ trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java	(revision 10417)
@@ -45,5 +45,5 @@
     private static long maxObjectTTL = -1;
     private static final String PREFERENCE_PREFIX = "jcs.cache";
-    private static BooleanProperty USE_BLOCK_CACHE = new BooleanProperty(PREFERENCE_PREFIX + ".use_block_cache", true);
+    public static BooleanProperty USE_BLOCK_CACHE = new BooleanProperty(PREFERENCE_PREFIX + ".use_block_cache", true);
 
     private static final AuxiliaryCacheFactory diskCacheFactory =
@@ -203,4 +203,5 @@
             BlockDiskCacheAttributes blockAttr = new BlockDiskCacheAttributes();
             blockAttr.setMaxKeySize(maxDiskObjects);
+            blockAttr.setBlockSizeBytes(4096); // use 4k blocks
             ret = blockAttr;
         } else {
@@ -216,7 +217,7 @@
             ret.setDiskPath(cachePath);
         }
-        ret.setCacheName(cacheName + (USE_BLOCK_CACHE.get() ? "_BLOCK" : "_INDEX"));
-
-        removeStaleFiles(cachePath + File.separator + cacheName, (USE_BLOCK_CACHE.get() ? "_INDEX" : "_BLOCK"));
+        ret.setCacheName(cacheName + (USE_BLOCK_CACHE.get() ? "_BLOCK_v2" : "_INDEX_v2"));
+
+        removeStaleFiles(cachePath + File.separator + cacheName, (USE_BLOCK_CACHE.get() ? "_INDEX_v2" : "_BLOCK_v2"));
         return ret;
     }
@@ -224,4 +225,6 @@
     private static void removeStaleFiles(String basePathPart, String suffix) {
         deleteCacheFiles(basePathPart); // TODO: this can be removed around 2016.09
+        deleteCacheFiles(basePathPart + "_BLOCK"); // TODO: this can be removed around 2016.09
+        deleteCacheFiles(basePathPart + "_INDEX"); // TODO: this can be removed around 2016.09
         deleteCacheFiles(basePathPart + suffix);
     }
Index: trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CommonSettingsPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CommonSettingsPanel.java	(revision 10416)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CommonSettingsPanel.java	(revision 10417)
@@ -8,4 +8,6 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.FilenameFilter;
 
 import javax.swing.JButton;
@@ -18,4 +20,5 @@
 import javax.swing.SpinnerNumberModel;
 
+import org.openstreetmap.josm.data.cache.JCSCacheManager;
 import org.openstreetmap.josm.data.imagery.CachedTileLoaderFactory;
 import org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer;
@@ -26,4 +29,5 @@
 import org.openstreetmap.josm.tools.ColorHelper;
 import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -129,4 +133,9 @@
         boolean restartRequired = false;
         if (!AbstractCachedTileSourceLayer.MAX_DISK_CACHE_SIZE.get().equals(this.maxElementsOnDisk.getValue())) {
+            if (((Integer)this.maxElementsOnDisk.getValue()) < AbstractCachedTileSourceLayer.MAX_DISK_CACHE_SIZE.get() &&
+                    JCSCacheManager.USE_BLOCK_CACHE.get()) {
+                // reducing size of the cache, this requires deletion of the files
+                removeCacheFiles(CachedTileLoaderFactory.PROP_TILECACHE_DIR.get());
+            }
             AbstractCachedTileSourceLayer.MAX_DISK_CACHE_SIZE.put((Integer) this.maxElementsOnDisk.getValue());
             restartRequired = true;
@@ -136,4 +145,5 @@
         if (!CachedTileLoaderFactory.PROP_TILECACHE_DIR.get().equals(this.tilecacheDir.getText())) {
             restartRequired = true;
+            removeCacheFiles(CachedTileLoaderFactory.PROP_TILECACHE_DIR.get()); // clear old cache directory
             CachedTileLoaderFactory.PROP_TILECACHE_DIR.put(this.tilecacheDir.getText());
         }
@@ -146,3 +156,18 @@
         return restartRequired;
     }
+
+    private void removeCacheFiles(String path) {
+        File directory = new File(path);
+        File[] cacheFiles = directory.listFiles(new FilenameFilter() {
+            @Override
+            public boolean accept(File dir, String name) {
+                return name.endsWith(".data") || name.endsWith(".key");
+            }
+
+        });
+        JCSCacheManager.shutdown(); // shutdown Cache - so files can by safely deleted
+        for (File cacheFile: cacheFiles) {
+            Utils.deleteFile(cacheFile);
+        }
+    }
 }
