public abstract class AbstractSession extends Object implements Session, io.vertx.ext.web.sstore.impl.SessionInternal
Constructor and Description |
---|
AbstractSession()
This constructor is mandatory (even though not referenced anywhere) is required for
serialization purposes.
|
AbstractSession(VertxContextPRNG random) |
AbstractSession(VertxContextPRNG random,
long timeout,
int length) |
Modifier and Type | Method and Description |
---|---|
protected int |
checksum() |
Session |
computeIfAbsent(String key,
java.util.function.Function<String,Object> mappingFunction)
Put some data in a session if absent.
|
protected int |
crc() |
Map<String,Object> |
data() |
void |
destroy()
Destroy the session
|
void |
flushed(boolean skipCrc)
Mark this session as flushed, this gives the object a change to clear any state management flags.
|
<T> T |
get(String key)
Get some data from the session
|
String |
id() |
void |
incrementVersion() |
boolean |
isDestroyed() |
boolean |
isEmpty() |
boolean |
isRegenerated() |
long |
lastAccessed() |
String |
oldId() |
Session |
put(String key,
Object obj)
Put some data in a session
|
Session |
putIfAbsent(String key,
Object obj)
Put some data in a session if absent
|
protected void |
readDataFromBuffer(Buffer buffer) |
protected int |
readDataFromBuffer(int pos,
Buffer buffer) |
Session |
regenerateId() |
<T> T |
remove(String key)
Remove some data from the session
|
void |
setAccessed()
Mark the session as being accessed.
|
protected void |
setData(JsonObject data) |
protected void |
setData(Map<String,Object> data) |
protected void |
setId(String id) |
protected void |
setLastAccessed(long lastAccessed) |
void |
setPRNG(VertxContextPRNG prng) |
protected void |
setTimeout(long timeout) |
protected void |
setVersion(int version) |
long |
timeout() |
int |
version() |
protected void |
writeDataToBuffer(Buffer buffer) |
public AbstractSession()
public AbstractSession(VertxContextPRNG random)
public AbstractSession(VertxContextPRNG random, long timeout, int length)
protected void setId(String id)
protected void setTimeout(long timeout)
protected void setData(JsonObject data)
protected void setLastAccessed(long lastAccessed)
protected void setVersion(int version)
public void setPRNG(VertxContextPRNG prng)
public void flushed(boolean skipCrc)
io.vertx.ext.web.sstore.impl.SessionInternal
flushed
in interface io.vertx.ext.web.sstore.impl.SessionInternal
skipCrc
- if the intention is NOT to keep using the session after this call,
a small optimization can be performed (skip updating the internal CRC)
which is unnecessary.public String id()
public Session regenerateId()
regenerateId
in interface Session
public long timeout()
public <T> T get(String key)
Session
public Session put(String key, Object obj)
Session
public Session putIfAbsent(String key, Object obj)
Session
putIfAbsent
in interface Session
key
- the key for the dataobj
- the datapublic Session computeIfAbsent(String key, java.util.function.Function<String,Object> mappingFunction)
Session
null
), attempts to compute its value using the given mapping
function and enters it into this map unless null
.computeIfAbsent
in interface Session
key
- the key for the datamappingFunction
- a mapping functionpublic <T> T remove(String key)
Session
public boolean isEmpty()
public long lastAccessed()
lastAccessed
in interface Session
public void setAccessed()
Session
setAccessed
in interface Session
public void destroy()
Session
public boolean isDestroyed()
isDestroyed
in interface Session
public boolean isRegenerated()
isRegenerated
in interface Session
public int version()
public void incrementVersion()
protected int crc()
protected int checksum()
protected void writeDataToBuffer(Buffer buffer)
protected int readDataFromBuffer(int pos, Buffer buffer)
protected void readDataFromBuffer(Buffer buffer)
Copyright © 2023 Eclipse. All rights reserved.