Class JCSCacheManager
java.lang.Object
org.openstreetmap.josm.data.cache.JCSCacheManager
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 Summary
FieldsModifier and TypeFieldDescriptionprivate static FileChannelprivate static FileLockstatic final IntegerPropertydefault objects to be held in memory by JCS caches (per region)private static final org.apache.commons.jcs3.auxiliary.AuxiliaryCacheFactoryprivate static final Loggerprivate static final longprivate static final Stringstatic final BooleanPropertyProperty that determines the disk cache implementation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voiddeleteCacheFiles(String basePathPart) static <K,V> org.apache.commons.jcs3.access.CacheAccess<K, V> Returns configured cache object for named cache regionstatic <K,V> org.apache.commons.jcs3.access.CacheAccess<K, V> Returns configured cache object with defined limits of memory cache and disk cacheprivate static <K,V> org.apache.commons.jcs3.access.CacheAccess<K, V> getCacheAccess(String cacheName, org.apache.commons.jcs3.engine.CompositeCacheAttributes cacheAttributes) private static org.apache.commons.jcs3.engine.CompositeCacheAttributesgetCacheAttributes(int maxMemoryElements) private static org.apache.commons.jcs3.auxiliary.disk.behavior.IDiskCacheAttributesgetDiskCacheAttributes(int maxDiskObjects, String cachePath, String cacheName) private static org.apache.commons.jcs3.auxiliary.AuxiliaryCacheFactoryprivate static voidremoveStaleFiles(String basePathPart, String suffix) static voidshutdown()Close all files to ensure, that all indexes and data are properly writtenprivate static boolean
-
Field Details
-
MAX_OBJECT_TTL
- See Also:
-
PREFERENCE_PREFIX
- See Also:
-
USE_BLOCK_CACHE
Property that determines the disk cache implementation -
DISK_CACHE_FACTORY
-
cacheDirChannel
-
cacheDirLock
-
DEFAULT_MAX_OBJECTS_IN_MEMORY
default objects to be held in memory by JCS caches (per region) -
jcsLog
-
-
Constructor Details
-
JCSCacheManager
private JCSCacheManager()
-
-
Method Details
-
getDiskCacheFactory
-
useBlockCache
-
getCache
Returns configured cache object for named cache region- Type Parameters:
K- key typeV- 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 typeV- value type- Parameters:
cacheName- region namemaxMemoryObjects- number of objects to keep in memorymaxDiskObjects- maximum size of the objects stored on disk in kBcachePath- 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
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
-
deleteCacheFiles
-
getCacheAttributes
private static org.apache.commons.jcs3.engine.CompositeCacheAttributes getCacheAttributes(int maxMemoryElements)
-