Package org.apache.commons.jcs3
Class JCS
java.lang.Object
org.apache.commons.jcs3.JCS
Simple class for using JCS. To use JCS in your application, you can use the static methods of
this class to get access objects (instances of this class) for your cache regions. One CacheAccess
object should be created for each region you want to access. If you have several regions, then
get instances for each. For best performance the getInstance call should be made in an
initialization method.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,
V> GroupCacheAccess<K, V> getGroupCacheInstance
(String region) Get a GroupCacheAccess which accesses the provided region.static <K,
V> GroupCacheAccess<K, V> getGroupCacheInstance
(String region, ICompositeCacheAttributes icca) Get a GroupCacheAccess which accesses the provided region.static <K,
V> GroupCacheAccess<K, V> getGroupCacheInstance
(String region, ICompositeCacheAttributes icca, IElementAttributes eattr) Get a GroupCacheAccess which accesses the provided region.static <K,
V> CacheAccess<K, V> getInstance
(String region) Get a CacheAccess which accesses the provided region.static <K,
V> CacheAccess<K, V> getInstance
(String region, ICompositeCacheAttributes icca) Get a CacheAccess which accesses the provided region.static <K,
V> CacheAccess<K, V> getInstance
(String region, ICompositeCacheAttributes icca, IElementAttributes eattr) Get a CacheAccess which accesses the provided region.static void
setConfigFilename
(String configFilename) Set the filename that the cache manager will be initialized with.static void
setConfigProperties
(Properties configProps) Set the properties that the cache manager will be initialized with.static void
setLogSystem
(String logSystem) Set the log system.static void
shutdown()
Shut down the cache manager and set the instance to null
-
Constructor Details
-
JCS
public JCS()
-
-
Method Details
-
setConfigFilename
Set the filename that the cache manager will be initialized with. Only matters before the instance is initialized.- Parameters:
configFilename
-
-
setConfigProperties
Set the properties that the cache manager will be initialized with. Only matters before the instance is initialized.- Parameters:
configProps
-
-
setLogSystem
Set the log system. Must be called before getInstance is called Predefined Log systems areLogManager.LOGSYSTEM_JAVA_UTIL_LOGGING
andLogManager.LOGSYSTEM_LOG4J2
- Parameters:
logSystem
- the logSystem to set
-
shutdown
Shut down the cache manager and set the instance to null -
getInstance
Get a CacheAccess which accesses the provided region.- Parameters:
region
- Region that return CacheAccess will provide access to- Returns:
- A CacheAccess which provides access to a given region.
- Throws:
CacheException
-
getInstance
public static <K,V> CacheAccess<K,V> getInstance(String region, ICompositeCacheAttributes icca) throws CacheException Get a CacheAccess which accesses the provided region.- Parameters:
region
- Region that return CacheAccess will provide access toicca
- CacheAttributes for region- Returns:
- A CacheAccess which provides access to a given region.
- Throws:
CacheException
-
getInstance
public static <K,V> CacheAccess<K,V> getInstance(String region, ICompositeCacheAttributes icca, IElementAttributes eattr) throws CacheException Get a CacheAccess which accesses the provided region.- Parameters:
region
- Region that return CacheAccess will provide access toicca
- CacheAttributes for regioneattr
- ElementAttributes for the region- Returns:
- A CacheAccess which provides access to a given region.
- Throws:
CacheException
-
getGroupCacheInstance
public static <K,V> GroupCacheAccess<K,V> getGroupCacheInstance(String region) throws CacheException Get a GroupCacheAccess which accesses the provided region.- Parameters:
region
- Region that return GroupCacheAccess will provide access to- Returns:
- A GroupCacheAccess which provides access to a given region.
- Throws:
CacheException
-
getGroupCacheInstance
public static <K,V> GroupCacheAccess<K,V> getGroupCacheInstance(String region, ICompositeCacheAttributes icca) throws CacheException Get a GroupCacheAccess which accesses the provided region.- Parameters:
region
- Region that return GroupCacheAccess will provide access toicca
- CacheAttributes for region- Returns:
- A GroupCacheAccess which provides access to a given region.
- Throws:
CacheException
-
getGroupCacheInstance
public static <K,V> GroupCacheAccess<K,V> getGroupCacheInstance(String region, ICompositeCacheAttributes icca, IElementAttributes eattr) throws CacheException Get a GroupCacheAccess which accesses the provided region.- Parameters:
region
- Region that return CacheAccess will provide access toicca
- CacheAttributes for regioneattr
- ElementAttributes for the region- Returns:
- A GroupCacheAccess which provides access to a given region.
- Throws:
CacheException
-