Ehcache最初是由Greg Luck于2003年开始开发。2009年,该项目被Terracotta购买。软件仍然是开源,但一些新的主要功能(例如,快速可重启性之间的一致性的)只能在商业产品中使用,例如Enterprise EHCache and BigMemory。维基媒体Foundationannounced目前使用的就是Ehcache技术。
package com.master.controller;
import com.master.bean.Account;
import com.master.dao.AccountDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by daizhao.
* User: tony
* Date: 2018-7-28
* Time: 22:41
* info:
*/
@RestController
public class AccountController {
@Autowired
private AccountDao accountDao;
@RequestMapping("/findAccount")
public String findAccount(){
return accountDao.findAccount(1).toString();
}
@RequestMapping("/getAccount")
public String getAccount(){
return accountDao.getAccount(1).toString();
}
@RequestMapping("/saveAccount")
public String saveAccount(){
Account account = new Account(4,"allen", 2000);
return accountDao.save(account) + "";
}
}
测试日志
JDBC Connection [HikariProxyConnection@139347354 wrapping com.mysql.jdbc.JDBC4Connection@14e7e982] will not be managed by Spring
==> Preparing: select id, name, money from account where id = ?
==> Parameters: 1(Integer)
<== Columns: id, name, money
<== Row: 1, aaa, 1000
<== Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3273fac8]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@30170780] was not registered for synchronization because synchronization is not active
Cache Hit Ratio [AccountOfMapper]: 0.5
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@30170780]