Changeset 10562 in josm for trunk/src/org


Ignore:
Timestamp:
2016-07-18T19:34:00+02:00 (8 years ago)
Author:
wiktorn
Message:

Use whole file if cache file size is greater than desired limit.

Closes: #13128

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java

    r10417 r10562  
    173173        if (cachePath != null && cacheDirLock != null) {
    174174            IDiskCacheAttributes diskAttributes = getDiskCacheAttributes(maxDiskObjects, cachePath, cacheName);
     175            /*
     176             * BlockDiskCache never optimizes the file, so when file size is reduced, it will never be truncated to desired size.
     177             *
     178             * If for some mysterious reason, file size is greater than the value set in preferences, just use the whole file. If the user
     179             * wants to reduce the file size, (s)he may just go to preferences and there it should be handled (by removing old file)
     180             */
     181            if (USE_BLOCK_CACHE.get()) {
     182                File diskCacheFile = new File(cachePath + File.separator + diskAttributes.getCacheName() + ".data");
     183                maxDiskObjects = (int) Math.max(maxDiskObjects, diskCacheFile.length()/1024);
     184            }
    175185            try {
    176186                if (cc.getAuxCaches().length == 0) {
Note: See TracChangeset for help on using the changeset viewer.