File tree Expand file tree Collapse file tree
java/io/kimmking/cache/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,11 +14,13 @@ public class UserServiceImpl implements UserService {
1414 @ Autowired
1515 UserMapper userMapper ;
1616
17+ // 开启spring cache
1718 @ Cacheable (key ="#id" ,value ="userCache" )
1819 public User find (int id ) {
1920 return userMapper .find (id );
2021 }
2122
23+ // 开启spring cache
2224 @ Cacheable (key ="LIST" ,value ="userCache" )
2325 public List <User > list (){
2426 return userMapper .list ();
Original file line number Diff line number Diff line change 22<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
33<mapper namespace =" io.kimmking.cache.mapper.UserMapper" >
44
5+ <!-- 开启mybatis cache -->
56 <cache type =" org.mybatis.caches.ehcache.LoggingEhcache" >
67 <property name =" memoryStoreEvictionPolicy" value =" LRU" />
78 </cache >
You can’t perform that action at this time.
0 commit comments