public class BTGStandardSessionContext extends Object implements BTGSessionContext
| 限定符 | 构造器和说明 |
|---|---|
protected |
BTGStandardSessionContext() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
active(BTGSession session)
激活session
|
void |
addSession(BTGSession session)
添加一个session
|
void |
checkSessionTimeout()
session清理算法机制:
1、设置清理周期,默认为30分钟;
2、非绝对清理,当触发了addSession、removeSession、refreshSession、getSession、getNewSession、active时触发清理机制;
3、通过调用clearTimeout手动清理;
|
void |
clear()
清空session容器
|
void |
clearTimeout()
清理超时的session
|
void |
disableCache()
禁用二级缓存
|
void |
enableCache()
启用二级缓存
|
int |
getMaxClearTimeoutMillis()
获取过期session清理机制触发周期(毫秒)
|
int |
getMaxUpdateLastActiveTimeMillis() |
BTGSession |
getNewSession()
获取一个新的session
|
BTGSession |
getSession(String sessionId)
根据session id获取一个session
|
static BTGStandardSessionContext |
getSessionContext() |
static BTGStandardSessionContext |
getSessionContext(BTGSessionDao sessionDao) |
BTGSessionDao |
getSessionDao()
获取session存储器
|
BTGSessionIdGenerator |
getSessionIdGenerator()
获取sessionId生成器
|
String |
getSessionIdKey()
获取session id名称key
|
Hashtable<String,BTGSession> |
getSessions()
获取所有session
|
int |
getSessionTimeoutMillis()
获取session超时时间
|
boolean |
isUseCache()
获取是否启用二级缓存
|
void |
refreshSession(BTGSession session)
刷新一个session
|
void |
removeSession(String sessionId)
根据session id移除一个session
|
void |
setMaxClearTimeoutMillis(int maxClearTimeoutMillis)
设置过期session清理机制触发周期(毫秒)
|
void |
setMaxUpdateLastActiveTimeMillis(int maxUpdateLastActiveTimeMillis) |
void |
setSessionDao(BTGSessionDao sessionDao)
设置session存储器
|
void |
setSessionIdGenerator(BTGSessionIdGenerator sessionIdGenerator)
设置sessionId生成器
|
void |
setSessionIdKey(String sesssionIdKey)
设置session id名称key
|
void |
setSessionTimeoutMillis(int sessionTimeoutMillis)
设置session超时时间
|
void |
setUseCache(boolean useCache)
设置是否启用二级缓存
|
public static BTGStandardSessionContext getSessionContext()
public static BTGStandardSessionContext getSessionContext(BTGSessionDao sessionDao)
public void enableCache()
BTGSessionContextenableCache 在接口中 BTGSessionContextpublic void disableCache()
BTGSessionContextdisableCache 在接口中 BTGSessionContextpublic void addSession(BTGSession session)
BTGSessionContextaddSession 在接口中 BTGSessionContextsession - BTGSessionpublic void removeSession(String sessionId)
BTGSessionContextremoveSession 在接口中 BTGSessionContextsessionId - Stringpublic void refreshSession(BTGSession session)
BTGSessionContextrefreshSession 在接口中 BTGSessionContextsession - BTGSessionpublic BTGSession getSession(String sessionId)
BTGSessionContextgetSession 在接口中 BTGSessionContextsessionId - Stringpublic BTGSession getNewSession()
BTGSessionContextgetNewSession 在接口中 BTGSessionContextpublic void active(BTGSession session)
BTGSessionContextactive 在接口中 BTGSessionContextsession - sessionpublic Hashtable<String,BTGSession> getSessions()
BTGSessionContextgetSessions 在接口中 BTGSessionContextpublic void clearTimeout()
BTGSessionContextclearTimeout 在接口中 BTGSessionContextpublic void checkSessionTimeout()
checkSessionTimeout 在接口中 BTGSessionContextpublic void clear()
BTGSessionContextclear 在接口中 BTGSessionContextpublic String getSessionIdKey()
BTGSessionContextgetSessionIdKey 在接口中 BTGSessionContextpublic void setSessionIdKey(String sesssionIdKey)
BTGSessionContextsetSessionIdKey 在接口中 BTGSessionContextsesssionIdKey - Stringpublic int getSessionTimeoutMillis()
BTGSessionContextgetSessionTimeoutMillis 在接口中 BTGSessionContextpublic void setSessionTimeoutMillis(int sessionTimeoutMillis)
BTGSessionContextsetSessionTimeoutMillis 在接口中 BTGSessionContextsessionTimeoutMillis - longpublic int getMaxClearTimeoutMillis()
BTGSessionContextgetMaxClearTimeoutMillis 在接口中 BTGSessionContextpublic void setMaxClearTimeoutMillis(int maxClearTimeoutMillis)
BTGSessionContextsetMaxClearTimeoutMillis 在接口中 BTGSessionContextmaxClearTimeoutMillis - intpublic int getMaxUpdateLastActiveTimeMillis()
public void setMaxUpdateLastActiveTimeMillis(int maxUpdateLastActiveTimeMillis)
public BTGSessionIdGenerator getSessionIdGenerator()
BTGSessionContextgetSessionIdGenerator 在接口中 BTGSessionContextpublic void setSessionIdGenerator(BTGSessionIdGenerator sessionIdGenerator)
BTGSessionContextsetSessionIdGenerator 在接口中 BTGSessionContextsessionIdGenerator - BTGSessionIdGeneratorpublic BTGSessionDao getSessionDao()
BTGSessionContextgetSessionDao 在接口中 BTGSessionContextpublic void setSessionDao(BTGSessionDao sessionDao)
BTGSessionContextsetSessionDao 在接口中 BTGSessionContextsessionDao - BTGSessionDaopublic boolean isUseCache()
BTGSessionContextisUseCache 在接口中 BTGSessionContextpublic void setUseCache(boolean useCache)
BTGSessionContextsetUseCache 在接口中 BTGSessionContextuseCache - useCacheCopyright © 2018. All rights reserved.