本文整理汇总了Java中org.apache.jcs.JCS类的典型用法代码示例。如果您正苦于以下问题:Java JCS类的具体用法?Java JCS怎么用?Java JCS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JCS类属于org.apache.jcs包,在下文中一共展示了JCS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JCSCache
import org.apache.jcs.JCS; //导入依赖的package包/类
public JCSCache(String regionName, java.util.Properties properties) throws CacheException {
try {
region = JCS.getInstance(regionName);
}
catch (org.apache.jcs.access.exception.CacheException e) {
log.error("could not create JCS region", e);
throw new CacheException(e);
}
}
示例2: DataSourceFactory
import org.apache.jcs.JCS; //导入依赖的package包/类
public DataSourceFactory(Collection<DataSource> sources, boolean caching) {
_sources = sources;
_caching = caching;
if (_caching) {
try {
_cache = JCS.getInstance("s2sCache");
} catch (CacheException e) {
log.error("Unable to setup JCS cache; caching not enabled.", e);
_caching = false;
}
}
}
示例3: InterfaceFactory
import org.apache.jcs.JCS; //导入依赖的package包/类
public InterfaceFactory(Collection<DataSource> sources, boolean caching) {
_sources = sources;
_caching = caching;
if (_caching) {
try {
_cache = JCS.getInstance("s2sCache");
} catch (CacheException e) {
log.error("Unable to setup JCS cache; caching not enabled.", e);
_caching = false;
}
}
}
示例4: InputFactory
import org.apache.jcs.JCS; //导入依赖的package包/类
public InputFactory( Collection<DataSource> sources, boolean caching) {
_sources = sources;
_caching = caching;
if (_caching) {
try {
_cache = JCS.getInstance("s2sCache");
} catch (CacheException e) {
log.error("Unable to setup JCS cache; caching not enabled.", e);
_caching = false;
}
}
}
示例5: SearchServiceFactory
import org.apache.jcs.JCS; //导入依赖的package包/类
public SearchServiceFactory(Collection<DataSource> sources, boolean caching) {
_sources = sources;
_caching = caching;
if (_caching) {
try {
_cache = JCS.getInstance("s2sCache");
} catch (CacheException e) {
log.error("Unable to setup JCS cache; caching not enabled.", e);
_caching = false;
}
}
}
示例6: WidgetFactory
import org.apache.jcs.JCS; //导入依赖的package包/类
public WidgetFactory(Collection<DataSource> sources, boolean caching) {
_sources = sources;
_caching = caching;
if (_caching) {
try {
_cache = JCS.getInstance("s2sCache");
} catch (CacheException e) {
log.error("Unable to setup JCS cache; caching not enabled.", e);
_caching = false;
}
}
}
示例7: FacetCollectionFactory
import org.apache.jcs.JCS; //导入依赖的package包/类
public FacetCollectionFactory(Collection<DataSource> sources, boolean caching) {
_sources = sources;
_caching = caching;
if (_caching) {
try {
_cache = JCS.getInstance("s2sCache");
} catch (CacheException e) {
log.error("Unable to setup JCS cache; caching not enabled.", e);
_caching = false;
}
}
}
示例8: ObjectCacheJCSImpl
import org.apache.jcs.JCS; //导入依赖的package包/类
/**
* Constructor used by the {@link ObjectCacheJCSPerClassImpl}
*/
public ObjectCacheJCSImpl(String name)
{
regionName = (name != null ? name : DEFAULT_REGION);
try
{
jcsCache = JCS.getInstance(regionName);
}
catch(Exception e)
{
throw new RuntimeCacheException("Can't instantiate JCS ObjectCacheImplementation", e);
}
}
示例9: JCSCache
import org.apache.jcs.JCS; //导入依赖的package包/类
public JCSCache() {
try {
cache = JCS.getInstance("OUR_REGION");
} catch (CacheException e) {
e.printStackTrace();
}
}
示例10: run
import org.apache.jcs.JCS; //导入依赖的package包/类
/** Run the shutdown hook for disposing of all caches. */
@Override
public void run() {
for (String cacheName : cacheNames) {
try {
logger.info("Shutting down " + cacheName + " cache.");
JCS.getInstance(cacheName).clear();
JCS.getInstance(cacheName).dispose();
}
catch (Exception e) {
String msg = "Failure to clear cache " + cacheName + ":" + e.getMessage();
logger.info(msg);
}
}
}
示例11: dispose
import org.apache.jcs.JCS; //导入依赖的package包/类
/**
* Shuts down the specified cache, and removes it from the list of active caches so it can be
* created again.
*
* @param cacheName The name of the cache to dispose of.
*/
public static void dispose(String cacheName) {
try {
cacheNames.remove(cacheName);
JCS.getInstance(cacheName).clear();
}
catch (CacheException e) {
String msg = "Failure to clear cache " + cacheName + ":" + e.getMessage();
logger.error(msg);
}
}
示例12: setUp
import org.apache.jcs.JCS; //导入依赖的package包/类
protected void setUp()
throws Exception
{
super.setUp();
org.apache.jcs.JCS.setConfigFilename( "/TestThrash.ccf" );
jcs = JCS.getInstance( "testcache" );
}
示例13: hear
import org.apache.jcs.JCS; //导入依赖的package包/类
@Override
public <I> void hear(TypeLiteral<I> typeLiteral, TypeEncounter<I> encounter) {
for (Field field : typeLiteral.getRawType().getDeclaredFields()) {
if (field.getType() == JCS.class
&& field.isAnnotationPresent(InjectJcs.class)) {
//
InjectJcs annot = field.getAnnotation(InjectJcs.class);
MembersInjector<I> injector = new InjectJcsMembersInjector<I>(
field, annot.cacheName());
encounter.register(injector);
}
}
}
示例14: next
import org.apache.jcs.JCS; //导入依赖的package包/类
@Override
public AlignmentCount next() {
Node<Integer> keyNode=iter.next();
Collection<Alignment> reads = new HashSet<Alignment>();
boolean flag=true;
Alignment value=null;
for(Integer key:keyNode.getContainedValues()){
try{
// for(Object key1:JCS.getInstance(cacheName).getGroupKeys(groupName)){
//logger.info((String)key1);
// }
// System.out.println("Attempt to GET "+key);
//Alignment read = (Alignment)treeCache.getFromGroup((Object)key,groupName);
Alignment read = (Alignment)JCS.getInstance(cacheName).get((Object)key);
if(read!=null){
if(read.getHeader()==null)
read.setHeader(model.getHeader());
reads.add(read);
//logger.info("Read is read");
}
else{
/* if(keys.contains(key)){
if(JCS.getInstance(cacheName).get(key)==null){
logger.info("Read is NULL BUT CONTAINS the key");
}
else{
if(keys.contains(key)){
logger.info("Read is NULL BUT DOES NOT contain the key but KEYS contains the KEY Cache "+cacheStart+":"+cacheEnd+" VS "+key);
}
else
logger.info("Read is NULL and its OKAY.");
}
}*/
}
if(flag && read!=null){
flag=false;
value = read;
}
}catch(CacheException e){
try {
JCS.getInstance(cacheName).clear();
} catch (CacheException e1) {
logger.error(e.getMessage());
}
logger.error(e.getMessage());
}
}
return model.new AlignmentCount(value,reads);
}
示例15: initCacheManager
import org.apache.jcs.JCS; //导入依赖的package包/类
/**
* 初始化缓存管理器
*
* @throws CacheException
* 缓存异常
*/
public static void initCacheManager() throws CacheException {
CacheManager.cache = JCS.getInstance(CACHE_REGION_NAME);
}