修改文件名

master
qi_liang 6 years ago
parent a5889f996d
commit 918e352411
  1. 13
      src/main/java/com/lq/code/cache/RedisSessionDao.java
  2. 2
      src/main/resources/spring/spring-shiro.xml

@ -38,15 +38,17 @@ public class RedisSessionDao extends EnterpriseCacheSessionDAO {
@Override
protected void doUpdate(Session session) {
LOGGER.warn("update shiro sesisonID:"+session.getId().toString());
//该方法交给父类去执行
super.doUpdate(session);
// super.doUpdate(session);
//更新reids中的session时间
redisTemplate.expire(session.toString(),this.defaultExpireTime, TimeUnit.SECONDS);
redisTemplate.expire(session.getId().toString(),this.defaultExpireTime, TimeUnit.SECONDS);
}
@Override
protected void doDelete(Session session) {
LOGGER.warn("delete shiro sessionID:"+session.getId().toString());
Serializable sessionId = session.getId();
cm = CacheManager.create();
if (cm == null){
@ -68,16 +70,17 @@ public class RedisSessionDao extends EnterpriseCacheSessionDAO {
Ehcache ehcache = cm.getCache("sessioncache");
assignSessionId(session,sessionId);
redisTemplate.opsForValue().set(sessionId.toString(),session);
redisTemplate.expire(session.toString(),this.defaultExpireTime, TimeUnit.SECONDS);
redisTemplate.expire(session.getId().toString(),this.defaultExpireTime, TimeUnit.SECONDS);
ehcache.put(new Element(sessionId.toString(),session));
LOGGER.info("create shiro sesisonId:"+sessionId.toString());
return sessionId;
}
@Override
protected Session doReadSession(Serializable serializable) {
LOGGER.warn("执行读取read session方法");
LOGGER.info("Read shiro sessionID:"+serializable.toString());
//此方法不会执行,不用管
return null;
return (Session)redisTemplate.opsForValue().get(serializable.toString());
}
protected InputStream getCacheMangerConfigFileImputStream(){

@ -39,7 +39,7 @@
<!-- 保证该系统不会受到跨域的脚本操作供给 -->
<property name="httpOnly" value="true"/>
<!-- 定义Cookie的过期时间,单位为秒,如果设置为-1表示浏览器关闭,则Cookie消失 -->
<property name="maxAge" value="-1"/>
<!-- <property name="maxAge" value="-1"/>-->
</bean>

Loading…
Cancel
Save