Class JCSCacheManager

java.lang.Object
org.openstreetmap.josm.data.cache.JCSCacheManager

public final class JCSCacheManager extends Object
Wrapper class for JCS Cache. Sets some sane environment and returns instances of cache objects. Static configuration for now assumes some small LRU cache in memory and larger LRU cache on disk
Since:
8168
  • Field Details

  • Constructor Details

  • Method Details

    • getDiskCacheFactory

      private static org.apache.commons.jcs3.auxiliary.AuxiliaryCacheFactory getDiskCacheFactory()
    • useBlockCache

      private static boolean useBlockCache()
    • getCache

      public static <K, V> org.apache.commons.jcs3.access.CacheAccess<K,V> getCache(String cacheName)
      Returns configured cache object for named cache region
      Type Parameters:
      K - key type
      V - value type
      Parameters:
      cacheName - region name
      Returns:
      cache access object
    • getCache

      public static <K, V> org.apache.commons.jcs3.access.CacheAccess<K,V> getCache(String cacheName, int maxMemoryObjects, int maxDiskObjects, String cachePath)
      Returns configured cache object with defined limits of memory cache and disk cache
      Type Parameters:
      K - key type
      V - value type
      Parameters:
      cacheName - region name
      maxMemoryObjects - number of objects to keep in memory
      maxDiskObjects - maximum size of the objects stored on disk in kB
      cachePath - path to disk cache. if null, no disk cache will be created
      Returns:
      cache access object
    • getCacheAccess

      private static <K, V> org.apache.commons.jcs3.access.CacheAccess<K,V> getCacheAccess(String cacheName, org.apache.commons.jcs3.engine.CompositeCacheAttributes cacheAttributes)
    • shutdown

      public static void shutdown()
      Close all files to ensure, that all indexes and data are properly written
    • getDiskCacheAttributes

      private static org.apache.commons.jcs3.auxiliary.disk.behavior.IDiskCacheAttributes getDiskCacheAttributes(int maxDiskObjects, String cachePath, String cacheName)
    • removeStaleFiles

      private static void removeStaleFiles(String basePathPart, String suffix)
    • deleteCacheFiles

      private static void deleteCacheFiles(String basePathPart)
    • getCacheAttributes

      private static org.apache.commons.jcs3.engine.CompositeCacheAttributes getCacheAttributes(int maxMemoryElements)