增加手机号查询用户基本信息缓存

parent a574abac
...@@ -62,6 +62,7 @@ import org.apache.commons.lang3.math.NumberUtils; ...@@ -62,6 +62,7 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -128,6 +129,7 @@ public class InnerController implements IBaseController { ...@@ -128,6 +129,7 @@ public class InnerController implements IBaseController {
@RequestMapping("/user/search/phoneNo") @RequestMapping("/user/search/phoneNo")
@LogHttpCaller @LogHttpCaller
@Cacheable(value = "usercache", key = "'userPhone' + #phoneNo", unless = "#result == null", cacheManager = "cacheManager")
public JsonResult findByPhoneNo(String phoneNo) { public JsonResult findByPhoneNo(String phoneNo) {
User user = userService.findByPhoneInDb(phoneNo); User user = userService.findByPhoneInDb(phoneNo);
if (user == null) { if (user == null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment