Class 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
    • Method Detail

      • getDiskCacheFactory

        private static org.apache.commons.jcs3.auxiliary.AuxiliaryCacheFactory getDiskCacheFactory()
      • 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)
      • getCacheAttributes

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