com.alachisoft.ncache.web.CacheSession Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ncache-javax-sessions Show documentation
Show all versions of ncache-javax-sessions Show documentation
NCache Enterprise integration for javax sessions.
The newest version!
package com.alachisoft.ncache.web;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Set;
public class CacheSession implements Serializable {
private String sessionId = "";
private long maxInactiveInterval = 0;
private boolean isNew = true;
private HashMap attributes = new HashMap();
private String prefix = null;
public CacheSession() {
}
//--------------------------------------------------------------------------------------------------------
public CacheSession(String prefix) {
this.prefix = prefix;
}
//--------------------------------------------------------------------------------------------------------
public boolean isIsNew() {
return isNew;
}
//--------------------------------------------------------------------------------------------------------
public void reset() {
maxInactiveInterval = 0;
isNew = true;
clearAttributes();
}
//--------------------------------------------------------------------------------------------------------
public void setIsNew(boolean isNew) {
this.isNew = isNew;
}
//--------------------------------------------------------------------------------------------------------
public void clearAttributes() {
attributes.clear();
}
//--------------------------------------------------------------------------------------------------------
public void setAttribute(String name, Object value) {
attributes.put(name, value);
}
//--------------------------------------------------------------------------------------------------------
public Object getAttribute(String key) {
if (attributes.containsKey(key)) {
return attributes.get(key);
}
return null;
}
//--------------------------------------------------------------------------------------------------------
public Set getKeys() {
return attributes.keySet();
}
//--------------------------------------------------------------------------------------------------------
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
//--------------------------------------------------------------------------------------------------------
public String getSessionId() {
return prefix + sessionId;
}
//--------------------------------------------------------------------------------------------------------
public void setMaxInactiveInterval(long interval) {
this.maxInactiveInterval = interval;
}
//--------------------------------------------------------------------------------------------------------
public long getMaxInactiveInterval() {
return maxInactiveInterval;
}
//--------------------------------------------------------------------------------------------------------
//setting current primary cache prefix in case of multi region
public void setPrefix(String prefix) {
this.prefix = prefix;
}
//--------------------------------------------------------------------------------------------------------
public boolean updateToCache() {
return true;
}
//--------------------------------------------------------------------------------------------------------
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy