Implement caching layer

1. Cache class design

2. Get Cache (focus)

3. The package is valid class

4. The Exception Handling

  • redis query failed, continue to let mysql query
  • mysql query fails, an exception is thrown, so to deal with a view
  • redis cache write failed, not treated

5. Clear Cache

6. data validation and data query

7. Personal Information Interface

Interface Design

# 个人中心-获取用户信息
/user
# 请求方式  
GET

# 响应形式 json
{
  "name": "",
  "photo_url": "",
  "centi": "",
  "art_counts": 3,
  "followings_count": 4,
  "fans_count": 5
}

Guess you like

Origin www.cnblogs.com/oklizz/p/11431540.html