shiro中的ehcache shiro.xml和mybatis中的ehcache shiro.xml有什么区别

shiro ehcache
缓存问题 - 开源中国社区
当前访客身份:游客 [
当前位置:
问题是这样的&&& 项目中用到了shiro + ehcache&&& 当我把tomcat&& shutdown后&&&&& webapp目录文件下的ehcache.xml文件无法删除&&& 查了写资料说是ehcache的问题,需要将cachemanager destory& 但是没用& 求大牛指导....
共有2个答案
<span class="a_vote_num" id="a_vote_num_
写个servlet 在 destroy方法里面 destroy cachemanager。 当然我没有遇到过你的问题,只是猜测。
--- 共有 2 条评论 ---
: 用spring来管理试试
(2年前)&nbsp&
我已经尝试过这种做法了,但是还是删除不了。
貌似缓存还在使用ehcache.xml
(2年前)&nbsp&
<span class="a_vote_num" id="a_vote_num_
本来就是交给spring管理了&&&&& spring+shiro+ehcache&&& 我快崩溃了....
更多开发者职位上
有什么技术问题吗?
灯光下的...的其它问题
类似的话题本帖子已过去太久远了,不再提供回复功能。shiro使用ehcache实现集群同步和session复制 - 坚持 - ITeye技术网站
博客分类:
一般情况下WEB应用集群的会话复制都是通过容器实现的,shiro权限框架中可以定义SessionDAO直接将session持久化到缓存中,这样只需要对缓存做集群就可以代替session的复制。
实现思路
1、用SessionDAO将session保存到ehcache缓存
2、配置ehcache的jgroups集群复制,如果集群服务器比较多,可升级到缓存服务器
思路很简单,但实现过程遇到不少问题,现在把过程及配置文件记录下来,避免忘记。
第一步将SessionDAO保存到ehcache缓存,这个步骤很简单,也没出什么问题,按照网上的例子很容易,下面是配置文件主要片段:
&!-- 主要是为了注入SessionDAO --&
&bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager"&
&property name="sessionDAO" ref="sessionDAO"/&
&!-- SessionDAO用shiro提供的默认实现 --&
&bean id="sessionDAO" class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO"&
&!-- &property name="activeSessionsCacheName" value="shiro-activeSessionCache"/& --&
&property name="cacheManager" ref="shiroCacheManager" /&
&!-- 为了实现自己的用户权限 --&
&bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"&
&property name="realm" ref="userRealm"/&
&property name="sessionManager" ref="sessionManager"/&
&!-- By default the servlet container sessions will be used.
Uncomment this line
to use shiro's native sessions (see the JavaDoc for more): --&
&!-- &property name="sessionMode" value="native"/& --&
&!-- 自定义的用户权限,这里也需要用缓存,避免从数据库加载权限 --&
&bean id="userRealm" class="cn.ys.security.UserRealm"&
&property name="cacheManager" ref="shiroCacheManager"/&
&property name="userService" ref="securityService" /&
&property name="credentialsMatcher" ref="credentialsMatcher"&&/property&
&!-- 与spring ehcache集成 --&
&bean id="shiroCacheManager" class="cn.ys.security.ehcache.EhCacheManager"&
&property name="cacheManager" ref="ehcacheFactory"&&/property&
第二步遇到很多问题,网上资料比较少,对jgroups又不熟,下面是配置文件及我遇到的问题:
ehcache.xml
&!-- 缓存同步jgroup配置 --&
&cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
properties="file=jgroups_tcp.xml"
&diskStore path="java.io.tmpdir/ehcache"/&
&defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
maxElementsOnDisk=""
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
&cache name="shiro-activeSessionCache"
maxElementsInMemory="1000"
overflowToDisk="true"
timeToLiveSeconds="0"
timeToIdleSeconds="0"
diskPersistent="true"
diskExpiryThreadIntervalSeconds="600"&
&cacheEventListenerFactory
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true" /&
&cache name="cn.ys.security.UserRealm.authorizationCache"
maxElementsInMemory="1000"
eternal="true"
overflowToDisk="true"&
&cacheEventListenerFactory
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true" /&
&cache name="org.apache.shiro.realm.text.PropertiesRealm-0-accounts"
maxElementsInMemory="1000"
eternal="true"
overflowToDisk="true"&
&cacheEventListenerFactory
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true" /&
jgroups_tcp.xml
&TCP bind_port="7800" bind_addr="localhost"
loopback="false"
recv_buf_size="${tcp.recv_buf_size:20M}"
send_buf_size="${tcp.send_buf_size:1M}"
discard_incompatible_packets="true"
max_bundle_size="2M"
max_bundle_timeout="30"
enable_bundling="true"
use_send_queues="true"
sock_conn_timeout="300"
timer_type="new"
timer.min_threads="4"
timer.max_threads="10"
timer.keep_alive_time="3000"
timer.queue_max_size="500"
thread_pool.enabled="true"
thread_pool.min_threads="1"
thread_pool.max_threads="10"
thread_pool.keep_alive_time="5000"
thread_pool.queue_enabled="false"
thread_pool.queue_max_size="100"
thread_pool.rejection_policy="discard"
oob_thread_pool.enabled="true"
oob_thread_pool.min_threads="1"
oob_thread_pool.max_threads="8"
oob_thread_pool.keep_alive_time="5000"
oob_thread_pool.queue_enabled="false"
oob_thread_pool.queue_max_size="100"
oob_thread_pool.rejection_policy="discard"
&TCPPING timeout="3000"
initial_hosts="localhost[7800]"
port_range="5"
num_initial_members="5"/&
min_interval="10000"
max_interval="30000"/&
&FD_SOCK/&
&FD timeout="3000" max_tries="3" /&
&VERIFY_SUSPECT timeout="1500"
&BARRIER /&
&pbcast.NAKACK use_mcast_xmit="false"
retransmit_timeout="300,600,00"
discard_delivered_msgs="true"/&
&pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="400000"/&
&pbcast.GMS print_local_addr="true" join_timeout="5000" view_bundling="true"/&
在网上查找的例子jgroups版本可能比较老,ehcache中的例子也一样,有些属性新的jgroups已经不认了,如start_port已经改成了bind_port,另外新版本jgroups增加了bind_addr,这样就可以直接指定ip地址绑定了,不需要在jvm上增加ipv4参数。
配置jgroups的几个需要理解的地方
1、jgroups的TCP的端口是自动分配自动发现的,同一台服务器上的多个实例不需要都配置到initial_hosts中,一个IP在initial_hosts中只需要定义一次,端口与bind_port保持一致
2、port_range是用于端口自动分配和自动发现用的,例如bind_port值为7800,当同服务上的第一个实例启动是使用7800端口,第二个实现启动时使用的是7801,最多只到7804
3、max_bundle_size不要太小,例子上该值只有64K,结果有时会现在无法复制的情况
4、当实例关闭再启动时,jgroups会认为是另一个host,原来的host如果不设置超时会一直存在,所以要注意设置keep_alive_time
浏览 11348
唉,我就想看看 这个sessionDAO在代码中是怎么用的,这个sessionDAO很多方法都是空,难道需要自己实现吗?我用的是apache shiro提供的org.apache.shiro.web.session.mgt.DefaultWebSessionManager,不需要自己写代码
浏览: 17056 次
来自: 武汉
cn.ys.security.ehcache.EhCacheM ...
&div class=&quote_title ...
唉,我就想看看 这个sessionDAO在代码中是怎么用的,这 ...
有源码吗?javaee(26)
12642人阅读
java(10)
Mybatis与Ehcache整合可以提高性能,降低数据库压力。查询百度发现整合Mybatis与Ehcache其实非常简单的。
下载mybatis相关包与ehcache相关包
下载地址为:
作者下载的是
其中自带了
mybatis-ehcache-1.0.3.jar
ehcache-core-2.6.8.jar
slf4j-api-1.6.1.jar
将这三个包导入到项目的jar文件下,就可以使用ehcache功能了。当然前提是保证mybatis没有引入ehcache前,项目也能正常运行。
作者用的mybatis3.2版本,框架用了SpringMVC3.2等等。
现在就试试效果吧。
在Map文件中打开echached效果,account-mapper.xml文件内容如下,(有的文章说还需要配置ehcache.xml,作者测试根本不需要这个配置):
&?xml version=&1.0& encoding=&UTF-8&?&
&!DOCTYPE mapper PUBLIC &-//mybatis.org//DTD Mapper 3.0//EN&
&&& &http://mybatis.org/dtd/mybatis-3-mapper.dtd&&
&mapper namespace=&com.springdemo.mapper.AccountMapper&&
&& &&!--mybatis ehcache缓存配置 --&
&& &&!-- 以下两个&cache&标签二选一,第一个可以输出日志,第二个不输出日志 --&
&& & &cache type=&org.mybatis.caches.ehcache.LoggingEhcache& /&
&& & &cache type=&org.mybatis.caches.ehcache.EhcacheCache&/&
&& &&!-- 以下与实体类的中字段一致 --&
&& &&sql id=&selectId&&
&& &&& &id,
&& &&& &accountName,
&& &&& &(select group_concat(name) from ly_role
&& &&& &where ly_role.id
&& &&& &in (SELECT role_id FROM acc_role WHERE
&& &&& &acc_id=account.id) ) roleName,
&& &&& &password,
&& &&& &description,
&& &&& &state,
&& &&& &createTime
&& &&/sql&
&& &&!--resultType=&Account& 每返回一条结果封装到Account里 --&
&& &&select id=&queryAll& resultType=&Account& parameterType=&Account&&
&& &&& &select
&& &&& &&include refid=&selectId& /&
&& &&& &from account
&& &&& &&where&
&& &&& &&& &&if test=&accountName != null and accountName != ''&&
&& &&& &&& &&& &accountName like '%${accountName}%'
&& &&& &&& &&/if&
&& &&& &&/where&
&& &&/select&
&& &&select id=&isExist& resultType=&Account& parameterType=&String&&
&& &&& &select
&& &&& &&include refid=&selectId& /&
&& &&& &from account
&& &&& &where accountName = #{accountName}
&& &&/select&
&& &&!--resultType=&Account& 每返回一条结果封装到Account里 --&
&& &&select id=&query& resultType=&Account& parameterType=&java.util.HashMap&&
&& &&& &select
&& &&& &&include refid=&selectId& /&
&& &&& &from account
&& &&& &&where&
&& &&& &&& &&if test=&t.accountName != null and t.accountName != ''&&
&& &&& &&& &&& &accountName like '%${t.accountName}%'
&& &&& &&& &&/if&
&& &&& &&/where&
&& &&& &&if test=&paging.startPage != null &&
&& &&& &limit #{paging.startPage} , #{paging.pageSize} &
&& &&& &&/if&
&& &&/select&
&& &&!--resultType=&Account& 记录条数,用于翻页查询 --&
&& &&select id=&queryCount& resultType=&long&& parameterType=&java.util.HashMap&&
&& &&& &&& &&& &select&& &&& &count(*)
&& &&& &from account
&& &&& &&where&
&& &&& &&& &&if test=&t.accountName != null and t.accountName != ''&&
&& &&& &&& &&& &accountName like '%${t.accountName}%'
&& &&& &&& &&/if&
&& &&& &&/where&
&& &&/select&
&& &&select id=&queryNoMatch& resultType=&Account& parameterType=&java.util.HashMap&&
&& &&& &select
&& &&& &a.id,
&& &&& &a.accountName,
&& &&& &a.password,
&& &&& &a.accountType,
&& &&& &a.description,
&& &&& &a.state,
&& &&& &a.createTime,
&& &&& &(SELECT dp.name from department dp where dp.id =
&& &&& &d.subdep_id) depName
&& &&& &from account a LEFT JOIN dep_account d on
&& &&& &a.id=d.account_id
&& &&& &&where&
&& &&& &&& &&if test=&t.accountName != null and t.accountName != ''&&
&& &&& &&& &&& &accountName like '%${t.accountName}%'
&& &&& &&& &&/if&
&& &&& &&/where&
&& &&/select&
&& &&!-- 增加用户 --&
&& &&insert id=&add& parameterType=&Account&&
&& &&& &insert into account (
&& &&& &accountName,
&& &&& &password,
&& &&& &description,
&& &&& &state )
&& &&& &values (#{accountName},
&& &&& &#{password}, #{description},
&& &&& &#{state})
&& &&/insert&
&& &&delete id=&delete& parameterType=&String&&
&& &&& &delete from account where
&& &&& &id=#{id}
&& &&/delete&
&& &&select id=&getById& parameterType=&String& resultType=&Account&&
&& &&& &select
&& &&& &&include refid=&selectId& /&
&& &&& &from account where id=#{id}
&& &&/select&
&& &&update id=&update& parameterType=&Account&&
&& &&& &update account
&& &&& &&set&
&& &&& &&& &&if test=&accountName != null and accountName != ''&&
&& &&& &&& &&& &accountName=#{accountName},
&& &&& &&& &&/if&
&& &&& &&& &&if test=&password != null and password != ''&&
&& &&& &&& &&& &password=#{password},
&& &&& &&& &&/if&
&& &&& &&& &&if test=&description != null and description != ''&&
&& &&& &&& &&& &description=#{description},
&& &&& &&& &&/if&
&& &&& &&& &&if test=&state != null and state != ''&&
&& &&& &&& &&& &state=#{state},
&& &&& &&& &&/if&
&& &&& &&& &&if test=&createTime != null and createTime != ''&&
&& &&& &&& &&& &createTime=#{createTime}
&& &&& &&& &&/if&
&& &&& &&/set&
&& &&& &where id=#{id}
&& &&/update&
&& &&!-- 验证用户登陆 --&
&& &&select id=&countAccount& parameterType=&Account& resultType=&Account&&
&& &&& &select
&& &&& &&include refid=&selectId& /&
&& &&& &from account where
&& &&& &accountName=#{accountName} and password=#{password}
&& &&/select&
&& &&!-- 根据用户名查出id --&
&& &&select id=&querySingleAccount& parameterType=&String&
&& &&& &resultType=&Account&&
&& &&& &select
&& &&& &&include refid=&selectId& /&
&& &&& &from account where accountName=#{accountName}
&& &&/select&
然后运行Account的查询程序,未启用cache的日志如下:
14:07:16,712 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-1 DispatcherServlet with name 'spring3' processing GET request for [/AnnExp2/background/account/list.do]
14:07:16,712 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.http-bio-8080-exec-1 Looking up handler method for path /background/account/list.do
14:07:16,722 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.http-bio-8080-exec-1 Returning handler method [public java.lang.String com.springdemo.usermgr.controller.AccountController.list(org.springframework.ui.Model,com.springdemo.usermgr.vo.Resources,java.lang.String)]
14:07:16,722 org.springframework.beans.factory.support.DefaultListableBeanFactory.http-bio-8080-exec-1 Returning cached instance of singleton bean 'accountController'
14:07:16,722 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-1 Last-Modified value for [/AnnExp2/background/account/list.do] is: -1
14:07:16,742 org.springframework.beans.factory.support.DefaultListableBeanFactory.http-bio-8080-exec-1 Invoking afterPropertiesSet() on bean with name 'background/account/list'
14:07:16,742 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-1 Rendering view [org.springframework.web.servlet.view.JstlView: name 'background/account/list'; URL [/WEB-INF/view/background/account/list.jsp]] in DispatcherServlet
with name 'spring3'
14:07:16,742 org.springframework.web.servlet.view.JstlView.http-bio-8080-exec-1 Added model object 'resources' of type [com.springdemo.usermgr.vo.Resources] to request in view with name 'background/account/list'
14:07:16,742 org.springframework.web.servlet.view.JstlView.http-bio-8080-exec-1 Added model object 'org.springframework.validation.BindingResult.resources' of type [org.springframework.validation.BeanPropertyBindingResult] to request in view
with name 'background/account/list'
14:07:16,742 org.springframework.web.servlet.view.JstlView.http-bio-8080-exec-1 Forwarding to resource [/WEB-INF/view/background/account/list.jsp] in InternalResourceView 'background/account/list'
14:07:16,762 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-1 Successfully completed request
14:07:16,762 org.springframework.beans.factory.support.DefaultListableBeanFactory.http-bio-8080-exec-1 Returning cached instance of singleton bean 'sqlSessionFactory'
14:07:16,995 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-1 DispatcherServlet with name 'spring3' processing POST request for [/AnnExp2/background/account/query.do]
14:07:16,995 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.http-bio-8080-exec-1 Looking up handler method for path /background/account/query.do
14:07:17,005 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.http-bio-8080-exec-1 Returning handler method [public com.lanyuan.pulgin.mybatis.plugin.PageView com.springdemo.usermgr.controller.AccountController.query(com.springdemo.usermgr.vo.Account,java.lang.String,java.lang.String)]
14:07:17,005 org.springframework.beans.factory.support.DefaultListableBeanFactory.http-bio-8080-exec-1 Returning cached instance of singleton bean 'accountController'
14:07:17,005 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-1 Creating a new SqlSession
14:07:17,005 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-1 SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1a891095] was not registered for synchronization because synchronization is not active
14:07:17,049 com.springdemo.mapper.AccountMapper.http-bio-8080-exec-1 Cache Hit Ratio [com.springdemo.mapper.AccountMapper]: 0.0
14:07:17,050 org.springframework.jdbc.datasource.DataSourceUtils.http-bio-8080-exec-1 Fetching JDBC Connection from DataSource
14:07:17,051 org.mybatis.spring.transaction.SpringManagedTransaction.http-bio-8080-exec-1 JDBC Connection [jdbc:://localhost:3306/test,
UserName=root@localhost, MySQL-AB JDBC Driver] will not be managed by Spring
14:07:17,051 com.springdemo.mapper.AccountMapper.queryCount.http-bio-8080-exec-1 ==&& Preparing: select count(*) from account
14:07:17,051 com.springdemo.mapper.AccountMapper.queryCount.http-bio-8080-exec-1 ==& Parameters:
14:07:17,052 com.springdemo.mapper.AccountMapper.queryCount.http-bio-8080-exec-1 &==&&&&& Total: 1
14:07:17,053 net.sf.ehcache.store.disk.Segment.http-bio-8080-exec-1 put added 0 on heap
14:07:17,053 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-1 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1a891095]
14:07:17,053 org.springframework.jdbc.datasource.DataSourceUtils.http-bio-8080-exec-1 Returning JDBC Connection to DataSource
14:07:17,053 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-1 Creating a new SqlSession
14:07:17,054 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-1 SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@271ffe2f] was not registered for synchronization because synchronization is not active
14:07:17,058 com.springdemo.mapper.AccountMapper.http-bio-8080-exec-1 Cache Hit Ratio [com.springdemo.mapper.AccountMapper]: 0.0
14:07:17,058 org.springframework.jdbc.datasource.DataSourceUtils.http-bio-8080-exec-1 Fetching JDBC Connection from DataSource
14:07:17,059 org.mybatis.spring.transaction.SpringManagedTransaction.http-bio-8080-exec-1 JDBC Connection [jdbc:mysql://localhost:3306/test, UserName=root@localhost, MySQL-AB JDBC Driver] will not be managed by Spring
14:07:17,060 com.springdemo.mapper.AccountMapper.query.http-bio-8080-exec-1 ==&& Preparing: select id, accountName, (select group_concat(name) from ly_role where ly_role.id in (SELECT role_id FROM acc_role WHERE acc_id=account.id) ) roleName,
password, description, state, createTime from account limit ? , ?
14:07:17,060 com.springdemo.mapper.AccountMapper.query.http-bio-8080-exec-1 ==& Parameters: 0(Integer), 5(Integer)
14:07:17,066 com.springdemo.mapper.AccountMapper.query.http-bio-8080-exec-1 &==&&&&& Total: 5
14:07:17,066 net.sf.ehcache.store.disk.Segment.http-bio-8080-exec-1 put added 0 on heap
14:07:17,067 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-1 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@271ffe2f]
14:07:17,067 org.springframework.jdbc.datasource.DataSourceUtils.http-bio-8080-exec-1 Returning JDBC Connection to DataSource
14:07:17,078 org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.http-bio-8080-exec-1 Written [com.lanyuan.pulgin.mybatis.plugin.PageView@380b2e5d] as &application/charset=UTF-8& using [org.springframework.http.converter.json.MappingJacksonHttpMessageConverter@1da6205a]
14:07:17,078 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-1 Null ModelAndView returned to DispatcherServlet with name 'spring3': assuming HandlerAdapter completed request handling
14:07:17,078 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-1 Successfully completed request
14:07:17,078 org.springframework.beans.factory.support.DefaultListableBeanFactory.http-bio-8080-exec-1 Returning cached instance of singleton bean 'sqlSessionFactory'
14:07:17,099 net.sf.ehcache.store.%002espringdemo%002emapper%002e%0041ccount%004dapper.data fault removed 0 from heap
14:07:17,099 net.sf.ehcache.store.%002espringdemo%002emapper%002e%0041ccount%004dapper.data fault added 0 on disk
14:07:17,100 net.sf.ehcache.store.%002espringdemo%002emapper%002e%0041ccount%004dapper.data fault removed 0 from heap
14:07:17,101 net.sf.ehcache.store.%002espringdemo%002emapper%002e%0041ccount%004dapper.data fault added 0 on disk
启用cache的命中后日志如下:
14:07:52,907 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-5 DispatcherServlet with name 'spring3' processing GET request for [/AnnExp2/background/account/list.do]
14:07:52,907 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.http-bio-8080-exec-5 Looking up handler method for path /background/account/list.do
14:07:52,917 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.http-bio-8080-exec-5 Returning handler method [public java.lang.String com.springdemo.usermgr.controller.AccountController.list(org.springframework.ui.Model,com.springdemo.usermgr.vo.Resources,java.lang.String)]
14:07:52,917 org.springframework.beans.factory.support.DefaultListableBeanFactory.http-bio-8080-exec-5 Returning cached instance of singleton bean 'accountController'
14:07:52,917 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-5 Last-Modified value for [/AnnExp2/background/account/list.do] is: -1
14:07:52,917 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-5 Rendering view [org.springframework.web.servlet.view.JstlView: name 'background/account/list'; URL [/WEB-INF/view/background/account/list.jsp]] in DispatcherServlet
with name 'spring3'
14:07:52,917 org.springframework.web.servlet.view.JstlView.http-bio-8080-exec-5 Added model object 'resources' of type [com.springdemo.usermgr.vo.Resources] to request in view with name 'background/account/list'
14:07:52,917 org.springframework.web.servlet.view.JstlView.http-bio-8080-exec-5 Added model object 'org.springframework.validation.BindingResult.resources' of type [org.springframework.validation.BeanPropertyBindingResult] to request in view
with name 'background/account/list'
14:07:52,917 org.springframework.web.servlet.view.JstlView.http-bio-8080-exec-5 Forwarding to resource [/WEB-INF/view/background/account/list.jsp] in InternalResourceView 'background/account/list'
14:07:52,917 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-5 Successfully completed request
14:07:52,917 org.springframework.beans.factory.support.DefaultListableBeanFactory.http-bio-8080-exec-5 Returning cached instance of singleton bean 'sqlSessionFactory'
14:07:53,121 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-5 DispatcherServlet with name 'spring3' processing POST request for [/AnnExp2/background/account/query.do]
14:07:53,121 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.http-bio-8080-exec-5 Looking up handler method for path /background/account/query.do
14:07:53,131 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.http-bio-8080-exec-5 Returning handler method [public com.lanyuan.pulgin.mybatis.plugin.PageView com.springdemo.usermgr.controller.AccountController.query(com.springdemo.usermgr.vo.Account,java.lang.String,java.lang.String)]
14:07:53,131 org.springframework.beans.factory.support.DefaultListableBeanFactory.http-bio-8080-exec-5 Returning cached instance of singleton bean 'accountController'
14:07:53,131 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-5 Creating a new SqlSession
14:07:53,131 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-5 SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@61b38786] was not registered for synchronization because synchronization is not active
14:07:53,131 com.springdemo.mapper.AccountMapper.http-bio-8080-exec-5 Cache Hit Ratio [com.springdemo.mapper.AccountMapper]: 0.25
14:07:53,131 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-5 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@61b38786]
14:07:53,131 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-5 Creating a new SqlSession
14:07:53,131 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-5 SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5d94e73a] was not registered for synchronization because synchronization is not active
14:07:53,131 com.springdemo.mapper.AccountMapper.http-bio-8080-exec-5 Cache Hit Ratio [com.springdemo.mapper.AccountMapper]: 0.4
14:07:53,131 org.mybatis.spring.SqlSessionUtils.http-bio-8080-exec-5 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5d94e73a]
14:07:53,131 org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.http-bio-8080-exec-5 Written [com.lanyuan.pulgin.mybatis.plugin.PageView@4c5c0e8b] as &application/charset=UTF-8& using [org.springframework.http.converter.json.MappingJacksonHttpMessageConverter@1da6205a]
14:07:53,131 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-5 Null ModelAndView returned to DispatcherServlet with name 'spring3': assuming HandlerAdapter completed request handling
14:07:53,131 org.springframework.web.servlet.DispatcherServlet.http-bio-8080-exec-5 Successfully completed request
14:07:53,131 org.springframework.beans.factory.support.DefaultListableBeanFactory.http-bio-8080-exec-5 Returning cached instance of singleton bean 'sqlSessionFactory'
可以看到前后明显差异,命中cache后,查询效率要明显提高。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:16443次
排名:千里之外
原创:35篇
转载:42篇
(9)(4)(21)(14)(6)(1)(11)(7)(3)(3)}

我要回帖

更多关于 ehcachemanager shiro 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信