Package io.karatelabs.http
Class Session
java.lang.Object
io.karatelabs.http.Session
- All Implemented Interfaces:
io.karatelabs.js.ObjectLike
Session state carrier.
Time fields (created, updated, expires) are
epoch seconds (UTC), not milliseconds. This unit choice makes the
value directly usable as a DynamoDB TTL attribute (which silently no-ops
on millisecond values) and matches the Unix-timestamp convention. Compare
against Instant.now().getEpochSecond(), never
System.currentTimeMillis().
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()longgetData()longgetId()longstatic SessioninMemory()booleanvoidvoidvoidsetExpires(long expires) voidsetUpdated(long updated) toMap()toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.karatelabs.js.ObjectLike
getMember, getPrototype, isExtensible, isFrozen, isOwnProperty, isSealed, putMember, removeMember, setExtensible, setFrozen, setSealed
-
Field Details
-
TEMPORARY
-
-
Constructor Details
-
Session
-
-
Method Details
-
inMemory
-
isTemporary
public boolean isTemporary() -
copy
-
setUpdated
public void setUpdated(long updated) - Parameters:
updated- epoch seconds (UTC)
-
setExpires
public void setExpires(long expires) - Parameters:
expires- epoch seconds (UTC)
-
getId
-
getData
-
getCreated
public long getCreated()- Returns:
- epoch seconds (UTC) when the session was created
-
getUpdated
public long getUpdated()- Returns:
- epoch seconds (UTC) of the most recent save
-
getExpires
public long getExpires()- Returns:
- epoch seconds (UTC) at which the session expires (DynamoDB-TTL-compatible)
-
getMember
- Specified by:
getMemberin interfaceio.karatelabs.js.ObjectLike
-
putMember
- Specified by:
putMemberin interfaceio.karatelabs.js.ObjectLike
-
removeMember
- Specified by:
removeMemberin interfaceio.karatelabs.js.ObjectLike
-
toMap
- Specified by:
toMapin interfaceio.karatelabs.js.ObjectLike
-
toString
-