首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

cassandra外部施用示例二

2012-10-06 
cassandra外部使用示例二续一的类:/**按给定的产品线节点,获取相关产品族列表* @return ListHashMap* @t

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;
    }

热点排行