public class InMemorySession extends java.lang.Object implements Session
Session that is help in-memory.| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.CharSequence,java.lang.Object> |
attributeMap |
protected io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
attributes |
protected java.time.Instant |
lastAccessTime |
| Modifier | Constructor and Description |
|---|---|
protected |
InMemorySession(java.lang.String id,
java.time.Duration maxInactiveInterval)
Constructor.
|
protected |
InMemorySession(java.lang.String id,
java.time.Instant creationTime,
java.time.Duration maxInactiveInterval)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
clear() |
<T> java.util.Optional<T> |
get(java.lang.CharSequence name,
io.micronaut.core.convert.ArgumentConversionContext<T> conversionContext) |
java.time.Instant |
getCreationTime()
Returns the time when this session was created.
|
java.lang.String |
getId()
A unique identifier for the session.
|
java.time.Instant |
getLastAccessedTime()
Returns the last time the client sent a request associated with this session as an
Instant. |
java.time.Duration |
getMaxInactiveInterval()
Returns the maximum time interval as a
Duration that sessions will be kept open between client accesses. |
boolean |
isModified() |
boolean |
isNew() |
java.util.Set<java.lang.String> |
names() |
io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
put(java.lang.CharSequence key,
java.lang.Object value) |
io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
remove(java.lang.CharSequence key) |
Session |
setLastAccessedTime(java.time.Instant instant)
Sets the last accessed time on the session.
|
Session |
setMaxInactiveInterval(java.time.Duration duration)
Specifies the duration between client requests before session should be invalidated.
|
void |
setNew(boolean aNew) |
java.util.Collection<java.lang.Object> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitof, putAll, putAllprotected final java.util.Map<java.lang.CharSequence,java.lang.Object> attributeMap
protected final io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> attributes
protected java.time.Instant lastAccessTime
protected InMemorySession(java.lang.String id,
java.time.Duration maxInactiveInterval)
id - The session idmaxInactiveInterval - The max inactive intervalprotected InMemorySession(java.lang.String id,
java.time.Instant creationTime,
java.time.Duration maxInactiveInterval)
id - The session idcreationTime - The creation timemaxInactiveInterval - The max inactive interval@NonNull public java.lang.String getId()
Session@NonNull public java.time.Instant getLastAccessedTime()
SessionInstant.
Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
getLastAccessedTime in interface SessionInstant representing the time the session was last accessedpublic Session setMaxInactiveInterval(java.time.Duration duration)
SessionsetMaxInactiveInterval in interface Sessionduration - A duration specifying the max inactive intervalpublic Session setLastAccessedTime(java.time.Instant instant)
SessionsetLastAccessedTime in interface Sessioninstant - The instant that represents the last accessed timepublic java.time.Duration getMaxInactiveInterval()
SessionDuration that sessions will be kept open between client accesses.
After this interval, the servlet container will invalidate the session. The maximum time interval can be set
with the setMaxInactiveInterval method.getMaxInactiveInterval in interface SessionSession.setMaxInactiveInterval(java.time.Duration)public boolean isNew()
public boolean isModified()
isModified in interface Session@NonNull public java.time.Instant getCreationTime()
SessiongetCreationTime in interface SessionInstant instancepublic io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> put(java.lang.CharSequence key,
java.lang.Object value)
put in interface io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object>public io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> remove(java.lang.CharSequence key)
remove in interface io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object>public io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> clear()
clear in interface io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object>public java.util.Set<java.lang.String> names()
names in interface io.micronaut.core.convert.value.ConvertibleValues<java.lang.Object>public java.util.Collection<java.lang.Object> values()
values in interface io.micronaut.core.convert.value.ConvertibleValues<java.lang.Object>public <T> java.util.Optional<T> get(java.lang.CharSequence name,
io.micronaut.core.convert.ArgumentConversionContext<T> conversionContext)
get in interface io.micronaut.core.value.ValueResolver<java.lang.CharSequence>public void setNew(boolean aNew)
aNew - Set is new