本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
}
示例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);
}
}
}
示例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;
}
}
}
示例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);
}
}
}
示例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;
}
}
}