🔨 优化缓存删除逻辑.
This commit is contained in:
@@ -42,6 +42,7 @@ import org.dromara.visor.common.utils.Assert;
|
||||
import org.dromara.visor.common.utils.Requests;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisStrings;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
||||
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
|
||||
import org.dromara.visor.module.common.config.AppLoginConfig;
|
||||
import org.dromara.visor.module.infra.api.SystemMessageApi;
|
||||
@@ -420,7 +421,7 @@ public class AuthenticationServiceImpl implements AuthenticationService {
|
||||
}
|
||||
// 删除续签信息
|
||||
if (Booleans.isTrue(appLoginConfig.getAllowRefresh())) {
|
||||
RedisStrings.scanKeysDelete(UserCacheKeyDefine.LOGIN_REFRESH.format(id, "*"));
|
||||
RedisUtils.scanKeysDelete(UserCacheKeyDefine.LOGIN_REFRESH.format(id, "*"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.framework.mybatis.core.query.ThenLambdaWrapper;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
||||
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
import org.dromara.visor.module.infra.dao.DataExtraDAO;
|
||||
import org.dromara.visor.module.infra.define.cache.DataExtraCacheKeyDefine;
|
||||
@@ -92,7 +93,7 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
insert.setValue(request.getValue());
|
||||
dataExtraDAO.insert(insert);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(request.getUserId(), request.getType(), request.getItem()));
|
||||
RedisUtils.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(request.getUserId(), request.getType(), request.getItem()));
|
||||
return insert.getId();
|
||||
}
|
||||
|
||||
@@ -114,7 +115,7 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
Set<String> keys = rows.stream()
|
||||
.map(s -> DataExtraCacheKeyDefine.DATA_EXTRA.format(s.getUserId(), s.getType(), s.getItem()))
|
||||
.collect(Collectors.toSet());
|
||||
RedisMaps.delete(keys);
|
||||
RedisUtils.delete(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,7 +134,7 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
// 更新
|
||||
int effect = dataExtraDAO.updateById(update);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(data.getUserId(), data.getType(), data.getItem()));
|
||||
RedisUtils.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(data.getUserId(), data.getType(), data.getItem()));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -315,7 +316,7 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
.map(s -> DataExtraCacheKeyDefine.DATA_EXTRA.format(s.getUserId(), s.getType(), s.getItem()))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
RedisMaps.delete(keys);
|
||||
RedisUtils.delete(keys);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -346,7 +346,7 @@ public class DataPermissionServiceImpl implements DataPermissionService {
|
||||
.map(s -> DataPermissionCacheKeyDefine.DATA_PERMISSION_USER.format(value, s))
|
||||
.forEach(keys::add);
|
||||
}
|
||||
RedisLists.delete(keys);
|
||||
RedisUtils.delete(keys);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.utils.Assert;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisLists;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
||||
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
|
||||
import org.dromara.visor.module.infra.convert.FavoriteConvert;
|
||||
@@ -79,7 +80,7 @@ public class FavoriteServiceImpl implements FavoriteService {
|
||||
// 插入
|
||||
favoriteDAO.insert(record);
|
||||
// 删除缓存
|
||||
RedisLists.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
RedisUtils.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
return record.getId();
|
||||
}
|
||||
|
||||
@@ -91,7 +92,7 @@ public class FavoriteServiceImpl implements FavoriteService {
|
||||
// 删除库
|
||||
int effect = favoriteDAO.deleteFavorite(type, userId, relId);
|
||||
// 删除缓存
|
||||
RedisLists.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
RedisUtils.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.dromara.visor.common.utils.Assert;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import org.dromara.visor.framework.mybatis.core.query.Conditions;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisLists;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
||||
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
import org.dromara.visor.module.infra.convert.TagConvert;
|
||||
import org.dromara.visor.module.infra.dao.TagDAO;
|
||||
@@ -116,7 +117,7 @@ public class TagServiceImpl implements TagService {
|
||||
int effect = tagDAO.updateById(updateRecord);
|
||||
log.info("HostProxyService-updateHostProxyById effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisLists.delete(TagCacheKeyDefine.TAG_NAME.format(record.getType()));
|
||||
RedisUtils.delete(TagCacheKeyDefine.TAG_NAME.format(record.getType()));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -201,7 +202,7 @@ public class TagServiceImpl implements TagService {
|
||||
.distinct()
|
||||
.map(TagCacheKeyDefine.TAG_NAME::format)
|
||||
.collect(Collectors.toList());
|
||||
RedisLists.delete(deleteKeys);
|
||||
RedisUtils.delete(deleteKeys);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -225,7 +226,7 @@ public class TagServiceImpl implements TagService {
|
||||
.distinct()
|
||||
.map(TagCacheKeyDefine.TAG_NAME::format)
|
||||
.collect(Collectors.toList());
|
||||
RedisLists.delete(cacheKeys);
|
||||
RedisUtils.delete(cacheKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user