修改用户缓存

master
OPGame 7 years ago
parent 1f6af397ab
commit 715d7f1eb7

@ -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);
} }

Loading…
Cancel
Save