Package io.micronaut.session
Class InMemorySession
java.lang.Object
io.micronaut.session.InMemorySession
- All Implemented Interfaces:
io.micronaut.core.convert.ConversionServiceProvider,io.micronaut.core.convert.value.ConvertibleValues<Object>,io.micronaut.core.convert.value.MutableConvertibleValues<Object>,io.micronaut.core.value.ValueResolver<CharSequence>,Session,Iterable<Map.Entry<String,Object>>
A
Session that is help in-memory.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<CharSequence,Object> protected final io.micronaut.core.convert.value.MutableConvertibleValues<Object>protected InstantFields inherited from interface io.micronaut.core.convert.value.ConvertibleValues
EMPTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInMemorySession(String id, Duration maxInactiveInterval) Constructor.protectedInMemorySession(String id, Instant creationTime, Duration maxInactiveInterval) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionio.micronaut.core.convert.value.MutableConvertibleValues<Object>clear()<T> Optional<T>get(CharSequence name, io.micronaut.core.convert.ArgumentConversionContext<T> conversionContext) @NonNull InstantReturns the time when this session was created.@NonNull StringgetId()A unique identifier for the session.@NonNull InstantReturns the last time the client sent a request associated with this session as anInstant.Returns the maximum time interval as aDurationthat sessions will be kept open between client accesses.booleanbooleanisNew()names()io.micronaut.core.convert.value.MutableConvertibleValues<Object>put(CharSequence key, Object value) io.micronaut.core.convert.value.MutableConvertibleValues<Object>remove(CharSequence key) setLastAccessedTime(Instant instant) Sets the last accessed time on the session.setMaxInactiveInterval(Duration duration) Specifies the duration between client requests before session should be invalidated.voidsetNew(boolean aNew) values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.convert.value.ConvertibleValues
asMap, asMap, asProperties, contains, forEach, getConversionService, getValue, getValueType, isEmpty, iterator, subMap, subMap, subMapMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface io.micronaut.core.convert.value.MutableConvertibleValues
putAll, putAllMethods inherited from interface io.micronaut.core.value.ValueResolver
get, get, get
-
Field Details
-
attributeMap
-
attributes
-
lastAccessTime
-
-
Constructor Details
-
InMemorySession
Constructor.- Parameters:
id- The session idmaxInactiveInterval- The max inactive interval
-
InMemorySession
Constructor.- Parameters:
id- The session idcreationTime- The creation timemaxInactiveInterval- The max inactive interval
-
-
Method Details
-
getId
Description copied from interface:SessionA unique identifier for the session. -
getLastAccessedTime
Description copied from interface:SessionReturns the last time the client sent a request associated with this session as anInstant.Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
- Specified by:
getLastAccessedTimein interfaceSession- Returns:
- An
Instantrepresenting the time the session was last accessed
-
setMaxInactiveInterval
Description copied from interface:SessionSpecifies the duration between client requests before session should be invalidated.- Specified by:
setMaxInactiveIntervalin interfaceSession- Parameters:
duration- A duration specifying the max inactive interval- Returns:
- The session
-
setLastAccessedTime
Description copied from interface:SessionSets the last accessed time on the session.- Specified by:
setLastAccessedTimein interfaceSession- Parameters:
instant- The instant that represents the last accessed time- Returns:
- The session
-
getMaxInactiveInterval
Description copied from interface:SessionReturns the maximum time interval as aDurationthat 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 thesetMaxInactiveIntervalmethod.- Specified by:
getMaxInactiveIntervalin interfaceSession- Returns:
- A duration specifying the time should session should remain open between client requests
- See Also:
-
isNew
public boolean isNew() -
isModified
public boolean isModified()- Specified by:
isModifiedin interfaceSession- Returns:
- Has the session been modified
-
getCreationTime
Description copied from interface:SessionReturns the time when this session was created.- Specified by:
getCreationTimein interfaceSession- Returns:
- An
Instantinstance
-
put
public io.micronaut.core.convert.value.MutableConvertibleValues<Object> put(CharSequence key, Object value) - Specified by:
putin interfaceio.micronaut.core.convert.value.MutableConvertibleValues<Object>
-
remove
- Specified by:
removein interfaceio.micronaut.core.convert.value.MutableConvertibleValues<Object>
-
clear
- Specified by:
clearin interfaceio.micronaut.core.convert.value.MutableConvertibleValues<Object>
-
names
- Specified by:
namesin interfaceio.micronaut.core.convert.value.ConvertibleValues<Object>
-
values
- Specified by:
valuesin interfaceio.micronaut.core.convert.value.ConvertibleValues<Object>
-
get
public <T> Optional<T> get(CharSequence name, io.micronaut.core.convert.ArgumentConversionContext<T> conversionContext) - Specified by:
getin interfaceio.micronaut.core.value.ValueResolver<CharSequence>
-
setNew
public void setNew(boolean aNew) - Parameters:
aNew- Set is new
-