From eb1d0c66ea8480c3836d6ae86aa0785a8936bf6c Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Sun, 25 Aug 2019 22:16:58 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DexpireTime=E4=BC=9A=E8=AF=9D?=
 =?UTF-8?q?=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4=E6=97=A0=E6=95=88=E9=97=AE?=
 =?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 pom.xml                                       |  2 +-
 .../src/main/resources/application.yml        |  2 +-
 .../main/resources/ehcache/ehcache-shiro.xml  | 27 ++++++++++++++++---
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/pom.xml b/pom.xml
index b13b0069..62eb104d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 		<java.version>1.8</java.version>
-		<shiro.version>1.4.0</shiro.version>
+		<shiro.version>1.4.1</shiro.version>
 		<thymeleaf.extras.shiro.version>2.0.0</thymeleaf.extras.shiro.version>
 		<mybatis.boot.version>1.3.2</mybatis.boot.version>
 		<druid.version>1.1.14</druid.version>
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index 15e79712..5d882930 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -109,7 +109,7 @@ shiro:
     # 设置Cookie的过期时间,天为单位
     maxAge: 30
   session:
-    # Session超时时间(默认30分钟)
+    # Session超时时间,-1代表永不过期(默认30分钟)
     expireTime: 30
     # 同步session到数据库的周期(默认1分钟)
     dbSyncPeriod: 1
diff --git a/ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml b/ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml
index 66c01c30..0ff3c1e2 100644
--- a/ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml
+++ b/ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml
@@ -3,7 +3,15 @@
 
     <!-- 磁盘缓存位置 -->
     <diskStore path="java.io.tmpdir"/>
-
+    
+    <!-- maxEntriesLocalHeap:堆内存中最大缓存对象数,0没有限制 -->
+    <!-- maxElementsInMemory: 在内存中缓存的element的最大数目。-->
+    <!-- eternal:elements是否永久有效,如果为true,timeouts将被忽略,element将永不过期 -->
+    <!-- timeToIdleSeconds:失效前的空闲秒数,当eternal为false时,这个属性才有效,0为不限制 -->
+    <!-- timeToLiveSeconds:失效前的存活秒数,创建时间到失效时间的间隔为存活时间,当eternal为false时,这个属性才有效,0为不限制 -->
+    <!-- overflowToDisk: 如果内存中数据超过内存限制,是否要缓存到磁盘上 -->
+    <!-- statistics:是否收集统计信息。如果需要监控缓存使用情况,应该打开这个选项。默认为关闭(统计会影响性能)。设置statistics="true"开启统计 -->
+    
     <!-- 默认缓存 -->
     <defaultCache
             maxEntriesLocalHeap="1000"
@@ -22,8 +30,8 @@
            overflowToDisk="false"
            statistics="true">
     </cache>
-    
-     <!-- 系统活跃用户缓存 -->
+
+    <!-- 系统活跃用户缓存 -->
     <cache name="sys-userCache"
            maxEntriesLocalHeap="10000"
            overflowToDisk="false"
@@ -32,7 +40,18 @@
            timeToLiveSeconds="0"
            timeToIdleSeconds="0"
            statistics="true">
-     </cache>
+    </cache>
+
+    <!-- 系统会话缓存 -->
+    <cache name="shiro-activeSessionCache"
+           maxElementsInMemory="10000"
+           overflowToDisk="true"
+           eternal="true"
+           timeToLiveSeconds="0"
+           timeToIdleSeconds="0"
+           diskPersistent="true"
+           diskExpiryThreadIntervalSeconds="600">
+    </cache>
 
 </ehcache>
 	
\ No newline at end of file