org.apache.jcs
Class JCS

java.lang.Object
  extended by org.apache.jcs.access.CacheAccess
      extended by org.apache.jcs.access.GroupCacheAccess
          extended by org.apache.jcs.JCS
All Implemented Interfaces:
ICacheAccess, IGroupCacheAccess

public class JCS
extends GroupCacheAccess

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. Ideally this class should be all you need to import to use JCS. One JCS 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.


Field Summary
 
Fields inherited from class org.apache.jcs.access.CacheAccess
cacheControl
 
Constructor Summary
protected JCS(CompositeCache cacheControl)
          Protected constructor for use by the static factory methods.
 
Method Summary
protected static void ensureCacheManager()
          Gets an instance of CompositeCacheManager and stores it in the cacheMgr class field, if it is not already set.
static JCS getInstance(java.lang.String region)
          Get a JCS which accesses the provided region.
static JCS getInstance(java.lang.String region, ICompositeCacheAttributes icca)
          Get a JCS which accesses the provided region.
static void setConfigFilename(java.lang.String configFilename)
          Set the filename that the cache manager will be initialized with.
 
Methods inherited from class org.apache.jcs.access.GroupCacheAccess
getFromGroup, getGroupAccess, getGroupAccess, getGroupKeys, invalidateGroup, putInGroup, putInGroup, remove
 
Methods inherited from class org.apache.jcs.access.CacheAccess
clear, defineRegion, defineRegion, defineRegion, destroy, destroy, dispose, freeMemoryElements, get, getAccess, getAccess, getCacheAttributes, getCacheElement, getCacheElements, getDefaultElementAttributes, getElementAttributes, getElementAttributes, getMatching, getMatchingCacheElements, getStatistics, getStats, put, put, putSafe, remove, remove, resetElementAttributes, resetElementAttributes, setCacheAttributes, setDefaultElementAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jcs.access.behavior.ICacheAccess
destroy, destroy, freeMemoryElements, get, getCacheAttributes, getCacheElement, getCacheElements, getElementAttributes, getElementAttributes, getMatching, getMatchingCacheElements, put, put, putSafe, remove, remove, resetElementAttributes, resetElementAttributes, setCacheAttributes
 

Constructor Detail

JCS

protected JCS(CompositeCache cacheControl)
Protected constructor for use by the static factory methods.

Parameters:
cacheControl - Cache which the instance will provide access to
Method Detail

getInstance

public static JCS getInstance(java.lang.String region)
                       throws CacheException
Get a JCS which accesses the provided region.

Parameters:
region - Region that return JCS will provide access to
Returns:
A JCS which provides access to a given region.
Throws:
CacheException

getInstance

public static JCS getInstance(java.lang.String region,
                              ICompositeCacheAttributes icca)
                       throws CacheException
Get a JCS which accesses the provided region.

Parameters:
region - Region that return JCS will provide access to
icca - CacheAttributes for region
Returns:
A JCS which provides access to a given region.
Throws:
CacheException

ensureCacheManager

protected static void ensureCacheManager()
Gets an instance of CompositeCacheManager and stores it in the cacheMgr class field, if it is not already set. Unlike the implementation in CacheAccess, the cache manager is a CompositeCacheManager. NOTE: This can will be moved up into GroupCacheAccess.


setConfigFilename

public static void setConfigFilename(java.lang.String configFilename)
Set the filename that the cache manager will be initialized with. Only matters before the instance is initialized.

Parameters:
configFilename -


Copyright © 2002-2010 Apache Software Foundation. All Rights Reserved.