当前位置: 首页>>代码示例>>Java>>正文


Java CacheException类代码示例

本文整理汇总了Java中org.apache.jcs.access.exception.CacheException的典型用法代码示例。如果您正苦于以下问题:Java CacheException类的具体用法?Java CacheException怎么用?Java CacheException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CacheException类属于org.apache.jcs.access.exception包,在下文中一共展示了CacheException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getResource

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
/**
 * 以缓存方式获得资源
 * @param id
 * @return
 */
public static Resource getResource(Long id) {
	Object obj = resCache.get(id);
	if (obj == null) {
		ResourceManager resManager = (ResourceManager) ObjectLocator
				.lookup("cmsResourceManager", CmsPlugin.PLUGIN_ID);
		if (resManager != null) {
			obj = resManager.getResourceById(id);
			if (obj != null) {
				try {
					resCache.put(id, obj);
				} catch (CacheException ex) {
					log.error(ex);
				}
			}
		}
	}
	return (Resource) obj;
}
 
开发者ID:juweiping,项目名称:ocms,代码行数:24,代码来源:ResourceCache.java

示例2: getNodePublishStat

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
/**
 * 从缓存中获得结点发布信息统计
 *  
 * @param nodeId 结点名
 * @return
 */
public static NodePublishStat getNodePublishStat(long nodeId) {
	Object obj = repoCache.get("publish-stat-" + nodeId);
	if (obj == null) {
		ContentIndexDao contentIndexDao = (ContentIndexDao) ObjectLocator
				.lookup("contentIndexDao", CmsPlugin.PLUGIN_ID);
		if (contentIndexDao != null) {
			long contentCount = contentIndexDao.getNodeContentCount(nodeId);
			long publishedConentCount = contentIndexDao
					.getNodePublishContentCount(nodeId);
			//
			NodePublishStat nodePublishStat = new NodePublishStat();
			nodePublishStat.setContentCount(contentCount);
			nodePublishStat.setPublishedConentCount(publishedConentCount);
			nodePublishStat.setNodeId(nodeId);
			//
			try {
				repoCache.put("publish-stat-" + nodeId, nodePublishStat);
				obj = nodePublishStat;
			} catch (CacheException ex) {
				log.error(ex);
			}
		}
	}
	return (NodePublishStat) obj;
}
 
开发者ID:juweiping,项目名称:ocms,代码行数:32,代码来源:RepoCache.java

示例3: getContentIndex

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
/**
 * 获得内容索引缓存
 * @param indexId
 * @return
 */
public static ContentIndex getContentIndex(Long indexId) {
	Object obj = repoCache.get("contentIndex-" + indexId);
	if (obj == null) {
		ContentIndexDao contentIndexDao = (ContentIndexDao) ObjectLocator
				.lookup("contentIndexDao", CmsPlugin.PLUGIN_ID);
		if (contentIndexDao != null) {
			obj = contentIndexDao.getContentIndexById(indexId);
			//
			if (obj != null) {
				//
				try {
					repoCache.put("contentIndex-" + indexId, obj);
				} catch (CacheException ex) {
					log.error(ex);
				}
			}
		}
	}
	return (ContentIndex) obj;
}
 
开发者ID:juweiping,项目名称:ocms,代码行数:26,代码来源:RepoCache.java

示例4: getAllFtpSetting

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
public static List<FtpSetting> getAllFtpSetting() {
	Object obj = vfsCache.get(FTP_SETTING_CACHE);
	if (obj == null) {
		FtpSettingManager tplTagManager = (FtpSettingManager) ObjectLocator
				.lookup("ftpSettingManager", CmsPlugin.PLUGIN_ID);
		if (tplTagManager != null) {
			obj=tplTagManager.getAllFtpSettings();
			if(obj!=null){
				try {
					vfsCache.put(FTP_SETTING_CACHE, obj);
				} catch (CacheException e) {
					e.printStackTrace();
				}
			}
		}
	}
	return (List) obj;
}
 
开发者ID:juweiping,项目名称:ocms,代码行数:19,代码来源:VfsCache.java

示例5: getAll

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
public static List<Psn> getAll(){
	Object obj = psnCache.get(ALL_KEY);
	if (obj == null) {
		PsnManager psnManager = (PsnManager) ObjectLocator.lookup(
				"psnManager", CmsPlugin.PLUGIN_ID);
		if (psnManager != null) {
			obj=psnManager.getAllPsn();
			if(obj!=null){
				try {
					psnCache.put(ALL_KEY, obj);
				} catch (CacheException ex) {
					log.error(ex);
				}
			}
		}
	}
	return (List<Psn>) obj;
}
 
开发者ID:juweiping,项目名称:ocms,代码行数:19,代码来源:PsnCache.java

示例6: getAllTags

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
public static List getAllTags() {
	Object obj = tplTagCache.get("all");
	if (obj == null) {
		TemplateTagManager tplTagManager = (TemplateTagManager) ObjectLocator
				.lookup("templateTagManager", CmsPlugin.PLUGIN_ID);
		if (tplTagManager != null) {
			obj=tplTagManager.getAllTags();
			if(obj!=null){
				try {
					tplTagCache.put("all", obj);
				} catch (CacheException e) {
					e.printStackTrace();
				}
			}
		}
	}
	return (List) obj;
}
 
开发者ID:juweiping,项目名称:ocms,代码行数:19,代码来源:TemplateTagCache.java

示例7: getAllNodes

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
/**
 * 从缓存中获取所有结点
 * 
 * @return
 */
public static List<Node> getAllNodes() {
	Object obj = nodeCache.get("all");
	if (obj == null) {
		NodeDao nodeDao = (NodeDao) ObjectLocator.lookup("nodeDao",
				CmsPlugin.PLUGIN_ID);
		if (nodeDao != null) {
			obj = nodeDao.getAllNodes();
			if (obj != null) {
				try {
					nodeCache.put("all", obj);
				} catch (CacheException e) {
					e.printStackTrace();
				}
			}
		}
	}
	return (List) obj;
}
 
开发者ID:juweiping,项目名称:ocms,代码行数:24,代码来源:NodeCache.java

示例8: getAllContentTables

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
public static List getAllContentTables() {
	Object obj = cmCache.get("all");
	if (obj == null) {
		ContentTableManager ctManager = (ContentTableManager) ObjectLocator
				.lookup("contentTableManager", CmsPlugin.PLUGIN_ID);
		if (ctManager != null) {
			obj = ctManager.getAllContentTable();
			if (obj != null) {
				try {
					cmCache.put("all", obj);
				} catch (CacheException e) {
					e.printStackTrace();
				}
			}
		}
	}
	return (List) obj;
}
 
开发者ID:juweiping,项目名称:ocms,代码行数:19,代码来源:ContentModelCache.java

示例9: getFieldsMap

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
/**
 * 获得内容域Map对象
 * 
 * @param alias
 * @return
 */
public static Map<String, ContentField> getFieldsMap(String alias) {
	Object rs = cmCache.get(alias + "-map");
	if (rs == null) {
		ContentTable ct = getContentTable(alias);
		if (ct != null) {
			Map<String, ContentField> fieldMap = new HashMap<String, ContentField>();
			List<ContentField> fields = getContentFields(ct.getTableId());
			for (ContentField field : fields) {
				fieldMap.put(field.getFieldName(), field);
			}
			try {
				cmCache.put(alias + "-map", fieldMap);
			} catch (CacheException e) {
				e.printStackTrace();
			}
			rs = fieldMap;
		}
	}
	return (Map<String, ContentField>) rs;
}
 
开发者ID:juweiping,项目名称:ocms,代码行数:27,代码来源:ContentModelCache.java

示例10: query

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
/**
 * Return an iteratory over an annotation window
 * @param window
 * @param fullyContained
 * @return
 * @throws CacheException 
 */
private CloseableIterator<AlignmentCount> query(Annotation window, boolean fullyContained) throws CacheException {
	//if larger than the cache size then just return the query directly
	if(window.getSize()>this.cacheSize){
		//logger.info("Get reads for the entire window of size "+window.getSize()+" for "+window.toUCSC());
		return getReads(window, fullyContained);
	}
	//else if doesnt contain the window then update cache and query again
	else if (!contains(window) || this.fullyContained != fullyContained) {
		//logger.info("this.fullyContained = " + this.fullyContained + "  fullyContained = " + fullyContained);
		//logger.info("Updating cache for "+window.getSize()+" for "+window.toUCSC());
		updateCache(window.getReferenceName(), window.getStart(), window.getEnd(), fullyContained);
	}
	//pull reads from cache
	return getReadsFromCache(window);
}
 
开发者ID:mgarber,项目名称:scriptureV2,代码行数:23,代码来源:JCSCache.java

示例11: DataSourceFactory

import org.apache.jcs.access.exception.CacheException; //导入依赖的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;
		}
	}
}
 
开发者ID:tetherless-world,项目名称:s2s,代码行数:13,代码来源:DataSourceFactory.java

示例12: saveToCache

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
private void saveToCache(String uri, DataSource obj) {
	if (_cache.get("DataSource:" + uri) == null) {
		try {
			_cache.putSafe("DataSource:" + uri, obj);
		} catch (CacheException e) {
			log.error("Unable to cache DataSource (" + uri + ").", e);
		}
	}
}
 
开发者ID:tetherless-world,项目名称:s2s,代码行数:10,代码来源:DataSourceFactory.java

示例13: InterfaceFactory

import org.apache.jcs.access.exception.CacheException; //导入依赖的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;
		}
	}
}
 
开发者ID:tetherless-world,项目名称:s2s,代码行数:13,代码来源:InterfaceFactory.java

示例14: saveToCache

import org.apache.jcs.access.exception.CacheException; //导入依赖的package包/类
private void saveToCache(String uri, Interface obj) {
	if (_cache.get("QueryInterface:" + uri) == null) {
		try {
			_cache.putSafe("QueryInterface:" + uri, obj);
		} catch (CacheException e) {
			log.error("Unable to cache QueryInterface (" + uri + ").", e);
		}
	}
}
 
开发者ID:tetherless-world,项目名称:s2s,代码行数:10,代码来源:InterfaceFactory.java

示例15: InputFactory

import org.apache.jcs.access.exception.CacheException; //导入依赖的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;
		}
	}
}
 
开发者ID:tetherless-world,项目名称:s2s,代码行数:13,代码来源:InputFactory.java


注:本文中的org.apache.jcs.access.exception.CacheException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。