Git Product home page Git Product logo

mybatis--mysql-memcached's Introduction

分布式缓存架构基础

  • clone作业工程

git clone http://git.intra.weibo.com/bootcamp2017/distributed-cache.git


* 资源地址

	```bash
mysql:
10.75.0.119:3306
用户名:root 密码:root
memcached:
10.75.0.118:11211
10.75.0.118:11311
10.75.0.118:11411
10.75.0.118:11511
  • 数据库建表

登录mysql,使用users数据库,建立以工号为名字的表 use users; create table 你的工号 ( id bigint not null, name varchar(32) not null, age int not null, gender varchar(10) not null, primary key (id) );


* 进入工程目录, 建立新分支, **分支名必须为邮箱前缀**, **补全代码**并提交

	```bash
cd distributed-cache
git checkout -b 邮箱前缀
# 补全代码
git add .
git commit -m "xxxx"
git push -u origin 分支名称
  • 根据课上所讲缓存相关知识及作业要求,补全com/weibo/api/users/controller/Users.java中的代码空行

@Controller @EnableAutoConfiguration @RequestMapping("/users") public class Users {

@Autowired
private VikaCacheClient usersCache;

@Autowired
private UsersDao usersDao;

public void setUsersCache(VikaCacheClient usersCache) {
    this.usersCache = usersCache;
}

public void setUsersDao(UsersDao usersDao) {
    this.usersDao = usersDao;
}

@RequestMapping(value = "/add.json", method = RequestMethod.POST)
@ResponseBody
public String usersAdd(@RequestParam("name") String name, 
                       @RequestParam("age") int age,
                       @RequestParam("gender") String gender) {
    // TODO Auto-generated method stub        
    return null;
}

@RequestMapping(value = "/delete.json", method = RequestMethod.POST)
@ResponseBody
public String usersDelete(@RequestParam("id") long id) {
    // TODO Auto-generated method stub
    return null;
}

@RequestMapping(value = "/modify.json", method = RequestMethod.POST)
@ResponseBody
public String usersModify(@RequestParam("id") long id,
                          @RequestParam("name") String name, 
                          @RequestParam("age") int age,
                          @RequestParam("gender") String gender) {
    // TODO Auto-generated method stub
    return null;
}

@RequestMapping(value = "/show.json", method = RequestMethod.GET)
@ResponseBody
public String usersShow(@RequestParam("id") long id) {
    // TODO Auto-generated method stub
    return null;
}

public static void main(String[] args) throws Exception {
    SpringApplication.run("classpath:applicationContext.xml", args);
}

}

    
* 尝试本地运行代码,并调用接口,验证Cache-DB的逻辑
    
* review代码, 并push到远程仓库

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.