|
|
|
@ -5,7 +5,7 @@ import com.manage.vo.Power_UserVo;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class CacheManager {
|
|
|
|
|
private static HashMap cacheMap = new HashMap();
|
|
|
|
|
private static HashMap<String,Cache> cacheMap = new HashMap<String,Cache>();
|
|
|
|
|
//添加异常数量
|
|
|
|
|
public static void addExcCount(String type){
|
|
|
|
|
if("noExc".equals(type)){
|
|
|
|
@ -93,14 +93,15 @@ public class CacheManager {
|
|
|
|
|
//根据用户信息删除缓存
|
|
|
|
|
private static void removeCacheByObject(Power_UserVo obj,String token) {
|
|
|
|
|
try {
|
|
|
|
|
Iterator i = cacheMap.entrySet().iterator();
|
|
|
|
|
while (i.hasNext()) {
|
|
|
|
|
Map.Entry<String,Object> entry = (Map.Entry) i.next();
|
|
|
|
|
Cache cache = CacheManager.getCacheInfo(entry.getKey());
|
|
|
|
|
if(null != cache.getValue() && cache.getValue() instanceof Power_UserVo){
|
|
|
|
|
Power_UserVo o = (Power_UserVo)cache.getValue();
|
|
|
|
|
if (obj.getUserName().equals(o.getUserName()) && !entry.getKey().equals(token)) {
|
|
|
|
|
clearOnly(entry.getKey());
|
|
|
|
|
if(cacheMap.size() > 0) {
|
|
|
|
|
for (Map.Entry<String, Cache> map : cacheMap.entrySet()) {
|
|
|
|
|
Cache cache = CacheManager.getCacheInfo(map.getKey());
|
|
|
|
|
assert cache != null;
|
|
|
|
|
if (null != cache.getValue() && cache.getValue() instanceof Power_UserVo) {
|
|
|
|
|
Power_UserVo o = (Power_UserVo) cache.getValue();
|
|
|
|
|
if (obj.getUserName().equals(o.getUserName()) && !map.getKey().equals(token)) {
|
|
|
|
|
clearOnly(map.getKey());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|