Commit bfc6e158 authored by Junling Bu's avatar Junling Bu
Browse files

fix[litemall-wx]: 采用ConcurrentHashMap

parent d2da8ca3
......@@ -5,12 +5,13 @@ import org.linlinjava.litemall.wx.dto.CaptchaItem;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 缓存系统中的验证码
*/
public class CaptchaCodeManager {
private static Map<String, CaptchaItem> captchaCodeCache = new HashMap<>();
private static ConcurrentHashMap<String, CaptchaItem> captchaCodeCache = new ConcurrentHashMap<>();
/**
* 添加到缓存
......
......@@ -3,6 +3,7 @@ package org.linlinjava.litemall.wx.service;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 简单缓存的数据
......@@ -13,7 +14,7 @@ public class HomeCacheManager {
public static final String CATALOG = "catalog";
public static final String GOODS = "goods";
private static Map<String, Map<String, Object>> cacheDataList = new HashMap<>();
private static ConcurrentHashMap<String, Map<String, Object>> cacheDataList = new ConcurrentHashMap<>();
/**
* 缓存首页数据
......@@ -66,7 +67,7 @@ public class HomeCacheManager {
* 清除所有缓存
*/
public static void clearAll() {
cacheDataList = new HashMap<>();
cacheDataList = new ConcurrentHashMap<>();
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment