zoukankan      html  css  js  c++  java
  • redis 缓存类型为map

        // 获取分类列表,以及同类品牌
        public Map<String, List> getCatalogInfo(Product product) {
    
            String key = CacheKeyUtils.getCacheKey(NAMESPACE, product);
            Map<String, List> resutMap = (Map<String, List>) cache.get(key);
            if (null == resutMap) {
                resutMap = new HashMap<String, List>();
                List<ProductCatalog> catalogList = Lists.newArrayList();
                List<ProductBrand> similarCatalogBrands = new ArrayList<ProductBrand>();
                if (product.getProCatalogId() != null) {
                    ProductCatalog productCatalog = catalogService.getCatalogById(product.getProCatalogId());
                    String fullIndex = productCatalog.getFullIndex().replace(".", ",");
                    if (null != fullIndex) {
                        String[] indexes = fullIndex.split(",");
                        if (indexes != null && indexes.length > 1) {
                            // 同类品牌
                            similarCatalogBrands = catalogService.getSimilarCatalogBrands(Integer.parseInt(indexes[1]));
                        }
                        // for (String index : indexes) {
                        // ProductCatalog g =
                        // catalogService.getCatalogById(Integer.parseInt(index));
                        // catalogList.add(g);
                        // }
                        List<Integer> catalogIds = new ArrayList<Integer>();
                        for (String index : indexes) {
                            catalogIds.add(Integer.parseInt(index));
                        }
                        // 分类列表
                        catalogList = catalogService.getCatalogByIds(catalogIds);
                    }
                }
                resutMap.put("catalogList", catalogList);
                resutMap.put("similarCatalogBrands", similarCatalogBrands);
                cache.put(key, resutMap, 60);
            }
            return resutMap;
        };
  • 相关阅读:
    pixijs shader 制作百叶窗效果
    pixijs shader 贴图溶解效果教程
    shadertoy使用教程
    pixijs shader教程
    glsl shader简明教程系列1
    javascript判断mp3是否播放完
    wxWidgets Tutorial
    NYOJ 214 最长上升子序列nlogn
    解决codeforces访问慢的问题
    dp 斯特林数 HDU2512一卡通大冒险
  • 原文地址:https://www.cnblogs.com/wangchuanfu/p/8335534.html
Copyright © 2011-2022 走看看