OPGame 6 жил өмнө
parent
commit
715d7f1eb7

+ 2 - 1
yami-shop-service/src/main/java/com/yami/shop/service/impl/UserServiceImpl.java

@@ -17,6 +17,7 @@ import com.yami.shop.dao.UserMapper;
 import com.yami.shop.service.UserService;
 import com.yami.shop.service.UserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.util.Date;
 import java.util.Date;
@@ -33,7 +34,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 
 
 
 
     @Override
     @Override
-    @CacheEvict(cacheNames="user",key="#userId")
+    @Cacheable(cacheNames="user",key="#userId")
     public User getUserByUserId(String userId) {
     public User getUserByUserId(String userId) {
         return userMapper.selectById(userId);
         return userMapper.selectById(userId);
     }
     }