Java Code Examples for org.apache.shiro.web.session.mgt.DefaultWebSessionManager#setSessionDAO()
The following examples show how to use
org.apache.shiro.web.session.mgt.DefaultWebSessionManager#setSessionDAO() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShiroConfig.java From springboot-learn with MIT License | 6 votes |
/** * 会话管理器 */ @Bean public DefaultWebSessionManager sessionManager() { DefaultWebSessionManager manager = new DefaultWebSessionManager(); // 加入缓存管理器 manager.setCacheManager(getEhCacheManager()); // 删除过期的session manager.setDeleteInvalidSessions(true); // 设置全局session超时时间 manager.setGlobalSessionTimeout(30 * 60 * 1000); // 是否定时检查session manager.setSessionValidationSchedulerEnabled(true); // 自定义SessionDao manager.setSessionDAO(new EnterpriseCacheSessionDAO()); return manager; }
Example 2
Source File: ShiroConfig.java From erp-framework with MIT License | 5 votes |
/** * 配置会话管理器,设定会话超时及保存 * @return */ @Bean public SessionManager sessionManager() { DefaultWebSessionManager manager = new DefaultWebSessionManager(); //设置session过期时间为1小时(单位:毫秒),默认为30分钟 manager.setGlobalSessionTimeout(60 * 60 * 1000); // 是否开启定时调度器进行检测过期session manager.setSessionValidationSchedulerEnabled(true); manager.setSessionDAO(sessionDao()); return manager; }
Example 3
Source File: ShiroConfig.java From mysiteforme with Apache License 2.0 | 5 votes |
@Bean public SessionManager webSessionManager(){ DefaultWebSessionManager manager = new DefaultWebSessionManager(); //设置session过期时间为1小时(单位:毫秒),默认为30分钟 manager.setGlobalSessionTimeout(60 * 60 * 1000); manager.setSessionValidationSchedulerEnabled(true); manager.setSessionDAO(redisSessionDAO()); return manager; }
Example 4
Source File: ShiroConfig.java From Spring-Shiro-Spark with Apache License 2.0 | 5 votes |
@Bean(name = "sessionManager") public DefaultWebSessionManager sessionManager(){ DefaultWebSessionManager manager = new DefaultWebSessionManager(); //manager.setCacheManager(cacheManager);// 加入缓存管理器 manager.setSessionFactory(shiroSessionFactory());//设置sessionFactory manager.setSessionDAO(shiroSessionDao());// 设置SessionDao manager.setDeleteInvalidSessions(true);// 删除过期的session manager.setGlobalSessionTimeout(shiroSessionDao().getExpireTime());// 设置全局session超时时间 manager.setSessionValidationSchedulerEnabled(true);// 是否定时检查session return manager; }