Index: trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java	(revision 10322)
+++ trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java	(revision 10323)
@@ -19,4 +19,6 @@
 import org.apache.commons.jcs.auxiliary.disk.block.BlockDiskCacheAttributes;
 import org.apache.commons.jcs.auxiliary.disk.block.BlockDiskCacheFactory;
+import org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes;
+import org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory;
 import org.apache.commons.jcs.engine.CompositeCacheAttributes;
 import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes.DiskUsagePattern;
@@ -26,4 +28,5 @@
 import org.openstreetmap.gui.jmapviewer.FeatureAdapter;
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.preferences.BooleanProperty;
 import org.openstreetmap.josm.data.preferences.IntegerProperty;
 
@@ -41,5 +44,8 @@
     private static long maxObjectTTL        = -1;
     private static final String PREFERENCE_PREFIX = "jcs.cache";
-    private static final AuxiliaryCacheFactory diskCacheFactory = new BlockDiskCacheFactory();
+    private static BooleanProperty USE_BLOCK_CACHE = new BooleanProperty(PREFERENCE_PREFIX + ".use_block_cache", true);
+
+    private static final AuxiliaryCacheFactory diskCacheFactory =
+            USE_BLOCK_CACHE.get() ? new BlockDiskCacheFactory() : new IndexedDiskCacheFactory();
     private static FileLock cacheDirLock;
 
@@ -163,6 +169,5 @@
 
         if (cachePath != null && cacheDirLock != null) {
-            IDiskCacheAttributes diskAttributes = getDiskCacheAttributes(maxDiskObjects, cachePath);
-            diskAttributes.setCacheName(cacheName);
+            IDiskCacheAttributes diskAttributes = getDiskCacheAttributes(maxDiskObjects, cachePath, cacheName);
             try {
                 if (cc.getAuxCaches().length == 0) {
@@ -190,17 +195,36 @@
     }
 
-    private static IDiskCacheAttributes getDiskCacheAttributes(int maxDiskObjects, String cachePath) {
-        BlockDiskCacheAttributes ret = new BlockDiskCacheAttributes();
+    private static IDiskCacheAttributes getDiskCacheAttributes(int maxDiskObjects, String cachePath, String cacheName) {
+        IDiskCacheAttributes ret;
+        if (USE_BLOCK_CACHE.get()) {
+            BlockDiskCacheAttributes blockAttr = new BlockDiskCacheAttributes();
+            blockAttr.setMaxKeySize(maxDiskObjects);
+            ret = blockAttr;
+        } else {
+            IndexedDiskCacheAttributes indexAttr = new IndexedDiskCacheAttributes();
+            indexAttr.setMaxKeySize(maxDiskObjects);
+            ret = indexAttr;
+        }
         ret.setDiskLimitType(IDiskCacheAttributes.DiskLimitType.SIZE);
-        ret.setMaxKeySize(maxDiskObjects);
-        if (cachePath != null) {
-            File path = new File(cachePath);
-            if (!path.exists() && !path.mkdirs()) {
-                LOG.log(Level.WARNING, "Failed to create cache path: {0}", cachePath);
-            } else {
-                ret.setDiskPath(path);
-            }
-        }
+        File path = new File(cachePath);
+        if (!path.exists() && !path.mkdirs()) {
+            LOG.log(Level.WARNING, "Failed to create cache path: {0}", cachePath);
+        } else {
+            ret.setDiskPath(cachePath);
+        }
+        ret.setCacheName(cacheName + (USE_BLOCK_CACHE.get() ? "_BLOCK" : "_INDEX"));
+
+        removeStaleFiles(cachePath + File.separator + cacheName, (USE_BLOCK_CACHE.get() ? "_INDEX" : "_BLOCK"));
         return ret;
+    }
+
+    private static void removeStaleFiles(String basePathPart, String suffix) {
+        deleteCacheFiles(basePathPart); // TODO: this can be removed around 2016.09
+        deleteCacheFiles(basePathPart + suffix);
+    }
+
+    private static void deleteCacheFiles(String basePathPart) {
+        new File(basePathPart + ".key").delete();
+        new File(basePathPart + ".data").delete();
     }
 
