
org.hidetake.spring.session.appengine.MemcacheSession Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-session-appengine Show documentation
Show all versions of spring-session-appengine Show documentation
Spring Session Integration for App Engine
The newest version!
package org.hidetake.spring.session.appengine;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.session.ExpiringSession;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@ToString
public class MemcacheSession implements ExpiringSession, Serializable {
private static final long serialVersionUID = 1L;
@Getter private final String id = UUID.randomUUID().toString();
@Getter private final long creationTime = System.currentTimeMillis();
private final Map attributes = new HashMap<>();
@Getter @Setter private long lastAccessedTime = creationTime;
@Getter @Setter private int maxInactiveIntervalInSeconds;
public MemcacheSession(int maxInactiveIntervalInSeconds) {
this.maxInactiveIntervalInSeconds = maxInactiveIntervalInSeconds;
}
@Override
public boolean isExpired() {
return false;
}
@Override
@SuppressWarnings("unchecked")
public T getAttribute(String attributeName) {
return (T) attributes.get(attributeName);
}
@Override
public Set getAttributeNames() {
return attributes.keySet();
}
@Override
public void setAttribute(String attributeName, Object attributeValue) {
attributes.put(attributeName, attributeValue);
}
@Override
public void removeAttribute(String attributeName) {
attributes.remove(attributeName);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy