feat(新增): 使用Cacheable插入数据

Signed-off-by: bunny <1319900154@qq.com>
This commit is contained in:
bunny 2024-03-27 15:38:30 +08:00
parent 7b06d59e57
commit 75de44cda0
1 changed files with 2 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import com.atguigu.product.service.CategoryService;
import com.atguigu.spzx.model.entity.product.Category;
import com.atguigu.utils.CategoryHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@ -46,6 +47,7 @@ public class CategoryServiceImpl implements CategoryService {
*
* @return 分类实体类列表
*/
@Cacheable(value = "category", key = "'all'")
@Override
public List<Category> findCategoryTree() {
// 查询所以分类返回list集合