Maison > Questions et réponses > le corps du texte
书上有一个关于PersistenManager
会话管理器的配置
<Context reloadable="true" >
<Manager className="org.apache.catalina.session.PersistentManager"
saveOnRestart="true"
maxActiveSessions="10"
minIdleSwap="60"
maxIdleSwap="120"
maxIdleBackup="180"
maxInactiveInterval="300">
<Store className="org.apache.catalina.session.FileStore" directory="mydir" />
</Manager>
</Context>
其中这两个属性很不理解:
maxIdleSwap="120"
maxIdleSwap为120s, 最大不活动时间为120s时会把会话保存在会话store中,那么在内存中的这个会话就会被销毁.
但是他还设置了maxIdleBackup="180"
maxIdleBackup为180s, 当不活动的时间大于180s时会把会话备份在store中
这个地方我就在想, 如果一个session在120s的时间被保存在store中, 怎么可能不活动时间为180呢?
我想的有什么不对吗?望大家指正
黄舟2017-04-17 12:07:05
Tomcat 文档:
maxIdleBackup
The time interval (in seconds) since the last access to a session before it is eligible for being persisted to the session store, or -1 to disable this feature. By default, this feature is disabled.
maxIdleSwap
The time interval (in seconds) since the last access to a session before it should be persisted to the session store, and passivated out of the server's memory, or -1 to disable this feature. If this feature is enabled, the time interval specified here should be equal to or longer than the value specified for maxIdleBackup. By default, this feature is disabled.
黑体部分:maxIdleSwap的值应该大于或等于maxIdleBackup