You've already forked FrameTour-BE
refactor(product): 移除商品类型能力缓存配置
- 删除类级别的缓存配置注解 - 移除方法上的缓存注解 - 简化缓存刷新逻辑 - 更新相关方法签名 - 清理缓存策略文档注释 - 调整依赖注入方式以适应无缓存场景
This commit is contained in:
@@ -14,22 +14,14 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 商品类型能力服务实现
|
||||
*
|
||||
* 缓存策略:
|
||||
* - 使用 Spring Cache 进行缓存
|
||||
* - 缓存名称:productTypeCapability
|
||||
* - 缓存key:商品类型代码
|
||||
* - 缓存失效:手动调用 refreshCache 方法
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "productTypeCapability")
|
||||
public class ProductTypeCapabilityServiceImpl implements IProductTypeCapabilityService {
|
||||
|
||||
@Autowired
|
||||
private ProductTypeCapabilityMapper mapper;
|
||||
|
||||
@Cacheable(key = "#productType")
|
||||
@Override
|
||||
public ProductTypeCapability getCapability(String productType) {
|
||||
if (productType == null || productType.trim().isEmpty()) {
|
||||
@@ -81,13 +73,11 @@ public class ProductTypeCapabilityServiceImpl implements IProductTypeCapabilityS
|
||||
return capability.getDuplicateCheckStrategyEnum();
|
||||
}
|
||||
|
||||
@CacheEvict(allEntries = true)
|
||||
@Override
|
||||
public void refreshCache() {
|
||||
log.info("刷新所有商品类型能力缓存");
|
||||
}
|
||||
|
||||
@CacheEvict(key = "#productType")
|
||||
@Override
|
||||
public void refreshCache(String productType) {
|
||||
log.info("刷新商品类型能力缓存: {}", productType);
|
||||
|
||||
Reference in New Issue
Block a user