...
|
...
|
@@ -424,6 +424,17 @@ public class ProductController { |
|
|
return new ApiResponse(200, "缓存清除成功!", Boolean.TRUE);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/product/clearProductDetailCache")
|
|
|
@IgnoreSignature
|
|
|
@IgnoreSession
|
|
|
public ApiResponse clearProductDetailCache(@RequestBody ProductRequestBo bo) {
|
|
|
Integer productId = bo.getId();
|
|
|
LOG.info("in clearProductDetailCache productId={}", productId);
|
|
|
clearProductDetailCache(productId);
|
|
|
LOG.info("clearProductDetailCache success productId = {}", productId);
|
|
|
return new ApiResponse(200, "缓存清除成功!", Boolean.TRUE);
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
private ControllerCacheAop cacheAop;
|
|
|
private ExecutorService executors = Executors.newFixedThreadPool(1);
|
...
|
...
|
@@ -485,6 +496,21 @@ public class ProductController { |
|
|
});
|
|
|
}
|
|
|
|
|
|
private void clearProductDetailCache(Integer productId) {
|
|
|
executors.execute(() -> {
|
|
|
try {
|
|
|
LOG.info("in clearProductDetailCache productId = {}", productId);
|
|
|
// 商品详情:数量
|
|
|
LOG.info("clearCache queryProductDetailById productId = {}, ", productId);
|
|
|
cacheAop.clearCache(
|
|
|
ProductController.class.getMethod("queryProductDetailById", new Class[]{Integer.class}),
|
|
|
new Object[]{productId});
|
|
|
} catch (Exception e) {
|
|
|
LOG.error("删除商品详情缓存失败!", e);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
private void clearBatchProductCache(List<Integer> skupList) {
|
|
|
executors.execute(() -> {
|
...
|
...
|
|