public class CacheHttpSession extends Object implements javax.servlet.http.HttpSession
| Constructor and Description |
|---|
CacheHttpSession(String id)
初始化时必须指定一个id字符串和缓存引擎实现。
|
| Modifier and Type | Method and Description |
|---|---|
void |
access()
表示此Session被访问。
|
boolean |
equals(Object obj) |
Object |
getAttribute(String attributeName)
获取属性值。
|
Enumeration<String> |
getAttributeNames() |
long |
getCreationTime()
获取此Session的创建时间。
|
String |
getId()
此Session的ID值。
这里返回存入cache的key值
|
long |
getLastAccessedTime()
获取最后访问时间。
|
int |
getMaxInactiveInterval() |
javax.servlet.ServletContext |
getServletContext() |
SessionAttribute |
getSessionAttribute()
获取当前的属性键值对。
|
javax.servlet.http.HttpSessionContext |
getSessionContext() |
Object |
getValue(String name) |
String[] |
getValueNames() |
int |
hashCode() |
void |
invalidate()
Session过期。
|
boolean |
isInvalid()
判断是否已经超过了最大活动时间。
|
boolean |
isNew()
判断此Session是否为新的。
|
void |
putValue(String name,
Object value) |
void |
removeAttribute(String attributeName)
移除已有的属性。
|
void |
removeSessionFromCache() |
void |
removeValue(String name) |
void |
setAttribute(String attributeName,
Object attributeValue)
更新属性。
|
void |
setMaxInactiveInterval(int interval) |
String |
sync()
更新当前Session至缓存。如果已经失效,从缓存中删除。
|
public CacheHttpSession(String id)
id - id字符串。public String getId()
getId in interface javax.servlet.http.HttpSessionpublic long getCreationTime()
getCreationTime in interface javax.servlet.http.HttpSessionpublic long getLastAccessedTime()
getLastAccessedTime in interface javax.servlet.http.HttpSessionpublic SessionAttribute getSessionAttribute()
public void access()
public void setMaxInactiveInterval(int interval)
setMaxInactiveInterval in interface javax.servlet.http.HttpSessioninterval - 秒public int getMaxInactiveInterval()
getMaxInactiveInterval in interface javax.servlet.http.HttpSessionpublic Object getAttribute(String attributeName)
getAttribute in interface javax.servlet.http.HttpSessionattributeName - 属性名称。public void setAttribute(String attributeName, Object attributeValue)
setAttribute in interface javax.servlet.http.HttpSessionattributeName - 属性名称。attributeValue - 属性值。public void removeAttribute(String attributeName)
removeAttribute in interface javax.servlet.http.HttpSessionattributeName - 属性名称。public void invalidate()
invalidate in interface javax.servlet.http.HttpSessionpublic boolean isInvalid()
public boolean isNew()
isNew in interface javax.servlet.http.HttpSessionpublic void removeSessionFromCache()
public String sync()
public Enumeration<String> getAttributeNames()
getAttributeNames in interface javax.servlet.http.HttpSessionpublic javax.servlet.ServletContext getServletContext()
getServletContext in interface javax.servlet.http.HttpSessionpublic javax.servlet.http.HttpSessionContext getSessionContext()
getSessionContext in interface javax.servlet.http.HttpSessionpublic Object getValue(String name)
getValue in interface javax.servlet.http.HttpSessionpublic String[] getValueNames()
getValueNames in interface javax.servlet.http.HttpSessionpublic void putValue(String name, Object value)
putValue in interface javax.servlet.http.HttpSessionpublic void removeValue(String name)
removeValue in interface javax.servlet.http.HttpSessionCopyright © 2020. All rights reserved.