cassandra外部使用示例二
续一的类:
/**按给定的产品线节点,获取相关产品族列表
* @return List<HashMap>
* @throws Exception
*/
public List<Map<String, Object>> getProductFamilyNodes(String itemId,
String nlsLang) throws ApplicationException
{
String aKeyArea = CACHE_FUNCTION + ".getProductFamilyNodes";
String aName = nlsLang + ":" + itemId;
//通过 aKeyArea 和 aName 获取缓存中的对象
if (IS_USE_CACHE)
{
List cacheList = (List) getLivingCacheObject(aKeyArea, aName);
if (cacheList != null && cacheList.size() > 0)
{
return cacheList;
}
}
//从数据库取数据,再存入缓存;
List dataList = navigationDao.getProductFamilyNodes(itemId, nlsLang);
if (IS_USE_CACHE && dataList != null && dataList.size() > 0)
{
pushCacheObject(aKeyArea, aName, dataList);
}
return dataList;
}
/**通过文档ID获取该文档的详细信息
*/
public Map<String, Object> getSingleKBdocBasicInfo(String docID)
throws ApplicationException
{
String aKeyArea = CACHE_FUNCTION + ".getSingleKBdoc";
String aName = docID;
//通过 aKeyArea 和 aName 获取缓存中的对象
if (IS_USE_CACHE)
{
Map cacheMap = (Map) getLivingCacheObject(aKeyArea, aName);
if (cacheMap != null && cacheMap.size() > 0)
{
return cacheMap;
}
}
//从数据库取数据,再存入缓存;
Map dataMap = navigationDao.getSingleKBdocBasicInfo(docID);
if (IS_USE_CACHE && dataMap != null && dataMap.size() > 0)
{
pushCacheObject(aKeyArea, aName, dataMap);
}
return dataMap;
}
public List<Map<String, Object>> getChildNodesByDocFamily(int level,
String itemId, String nlsLang) throws ApplicationException
{
String aKeyArea = CACHE_FUNCTION + ".getFamilyRelationItem";
String aName = level + ":" + nlsLang + ":" + itemId;
//通过 aKeyArea 和 aName 获取缓存中的对象
if (IS_USE_CACHE)
{
List cacheList = (List) getLivingCacheObject(aKeyArea, aName);
if (cacheList != null && cacheList.size() > 0)
{
return cacheList;
}
}
//从数据库取数据,再存入缓存;
List dataList = navigationDao.getChildNodesByDocFamily(level,
itemId,
nlsLang);
if (IS_USE_CACHE && dataList != null && dataList.size() > 0)
{
pushCacheObject(aKeyArea, aName, dataList);
}
return dataList;
}