realm的缓存

方法一:

在securityManager配置中添加cacheManager配置项,会注入到realm中。

方法二:在realm中配置。

realm本身实现了CacheManagerAware接口

public interface CacheManagerAware {

    /**
* Sets the available CacheManager instance on this component.
*
* @param cacheManager the CacheManager instance to set on this component.
*/
void setCacheManager(CacheManager cacheManager);
}

securityManager不只会帮realm注入cacheManager,还会帮sessionManager注入cacheManager

<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="cacheManager" ref="redisCacheManager" />
<property name="realm" ref="myRealm" />
<property name="sessionManager" ref="sessionManager"/>
</bean>

这样的话,realm和sessionManager就不用再配缓存

最新文章

  1. seaJs学习笔记2 – seaJs组建库的使用
  2. Bootstrap3系列:按钮式下拉菜单
  3. [转]10个有关RESTful API良好设计的最佳实践
  4. Gson运用
  5. JS调用腾讯接口获取天气
  6. UI实时预览最佳实践(转)
  7. sublime vue 语法高亮插件安装
  8. Python 解LeetCode:671. Second Minimum Node In a Binary Tree
  9. ionic 横向滚动 ion-scroll 进度条(步骤)// 根据后台数据控制当前默认滑动到的位置
  10. diffMerge安装配置使用
  11. spring注解-@Transactional事务几点注意
  12. (11)Microsoft office Word 2013版本操作入门_word中表格操作
  13. python中matplotlib画图
  14. delphi 调用QQ邮箱发送邮件
  15. 【工具相关】Web-Sublime Text2-安装插件HTMLPrettify
  16. Tensorflow[目录结构]
  17. Is this Sentence Difficult? Do you Agree? -paper
  18. 02 JDBC相关
  19. Freemarker全部文档和具体实例
  20. 一个关于react-native的demo,详细请转GitHub

热门文章

  1. jsp遍历集合
  2. login() got an unexpected keyword argument &#39;extra_context&#39;
  3. RuntimeError: cuda runtime error (10) : invalid device ordinal
  4. Struts2高级(插件)笔记一
  5. git——解决每次拉取、提交代码时都需要输入用户名和密码
  6. Go的WaitGroup
  7. Week of Code:GG
  8. C++11类内static成员变量声明与定义
  9. C++11通过拷贝构造器拷贝const字段(待解决)
  10. $.fn.exted({})与$.extend({})区别