Class JCSCacheManager


  • public final class JCSCacheManager
    extends java.lang.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
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private JCSCacheManager()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static void deleteCacheFiles​(java.lang.String basePathPart)  
      static <K,​V>
      org.apache.commons.jcs3.access.CacheAccess<K,​V>
      getCache​(java.lang.String cacheName)
      Returns configured cache object for named cache region
      static <K,​V>
      org.apache.commons.jcs3.access.CacheAccess<K,​V>
      getCache​(java.lang.String cacheName, int maxMemoryObjects, int maxDiskObjects, java.lang.String cachePath)
      Returns configured cache object with defined limits of memory cache and disk cache
      private static <K,​V>
      org.apache.commons.jcs3.access.CacheAccess<K,​V>
      getCacheAccess​(java.lang.String cacheName, org.apache.commons.jcs3.engine.CompositeCacheAttributes cacheAttributes)  
      private static org.apache.commons.jcs3.engine.CompositeCacheAttributes getCacheAttributes​(int maxMemoryElements)  
      private static org.apache.commons.jcs3.auxiliary.disk.behavior.IDiskCacheAttributes getDiskCacheAttributes​(int maxDiskObjects, java.lang.String cachePath, java.lang.String cacheName)  
      private static org.apache.commons.jcs3.auxiliary.AuxiliaryCacheFactory getDiskCacheFactory()  
      private static void removeStaleFiles​(java.lang.String basePathPart, java.lang.String suffix)  
      static void shutdown()
      Close all files to ensure, that all indexes and data are properly written
      private static boolean useBlockCache()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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​(java.lang.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​(java.lang.String cacheName,
                                                                                                 int maxMemoryObjects,
                                                                                                 int maxDiskObjects,
                                                                                                 java.lang.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​(java.lang.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,
                                                                                                                   java.lang.String cachePath,
                                                                                                                   java.lang.String cacheName)
      • removeStaleFiles

        private static void removeStaleFiles​(java.lang.String basePathPart,
                                             java.lang.String suffix)
      • deleteCacheFiles

        private static void deleteCacheFiles​(java.lang.String basePathPart)
      • getCacheAttributes

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