清除分类商品缓存

This commit is contained in:
Tankaikai 2025-04-16 15:33:28 +08:00
parent 954f2329bc
commit 6a9ef118bc
2 changed files with 13 additions and 0 deletions

View File

@ -144,4 +144,11 @@ public interface ProductService extends IService<Product> {
List<ProductVO> listAndLowPrice(Long shopId, List<Long> productIds);
/**
* 清除分类商品缓存
* @param shopId 店铺id
* @param categoryId 商品分类id
*/
void cleanCategoryProduct(Long shopId, Long categoryId);
}

View File

@ -778,4 +778,10 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
public List<ProductVO> listAndLowPrice(Long shopId, List<Long> productIds) {
return mapper.productList(shopId, productIds);
}
@Override
public void cleanCategoryProduct(Long shopId, Long categoryId) {
String key = ADMIN_CLIENT_PRODUCT_LIST + "::" + shopId + "::" + categoryId;
redisService.del(key);
}
}