public interface SessionStore
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SESSIONID_LENGTH
Default length for a session id.
|
Modifier and Type | Method and Description |
---|---|
default Future<Void> |
clear() |
void |
clear(Handler<AsyncResult<Void>> resultHandler)
Remove all sessions from the store.
|
void |
close()
Close the store
|
static SessionStore |
create(Vertx vertx)
Create a Session store given a backend and configuration JSON.
|
static SessionStore |
create(Vertx vertx,
JsonObject options)
Create a Session store given a backend and configuration JSON.
|
Session |
createSession(long timeout)
Create a new session using the default min length.
|
Session |
createSession(long timeout,
int length)
Create a new session.
|
default Future<Void> |
delete(String cookieValue) |
void |
delete(String id,
Handler<AsyncResult<Void>> resultHandler)
Delete the session with the specified ID.
|
default Future<Session> |
get(String cookieValue) |
void |
get(String cookieValue,
Handler<AsyncResult<Session>> resultHandler)
Get the session with the specified ID.
|
SessionStore |
init(Vertx vertx,
JsonObject options)
Initialize this store.
|
default Future<Void> |
put(Session session) |
void |
put(Session session,
Handler<AsyncResult<Void>> resultHandler)
Add a session with the specified ID.
|
long |
retryTimeout()
The retry timeout value in milli seconds used by the session handler when it retrieves a value from the store.
A non positive value means there is no retry at all.
|
default Future<Integer> |
size() |
void |
size(Handler<AsyncResult<Integer>> resultHandler)
Get the number of sessions in the store.
|
static final int DEFAULT_SESSIONID_LENGTH
static SessionStore create(Vertx vertx)
vertx
- vertx instancestatic SessionStore create(Vertx vertx, JsonObject options)
vertx
- vertx instanceoptions
- extra options for initializationSessionStore init(Vertx vertx, JsonObject options)
vertx
- the vertx instanceoptions
- optional Json with extra configuration optionslong retryTimeout()
Session createSession(long timeout)
timeout
- - the session timeout, in msSession createSession(long timeout, int length)
timeout
- - the session timeout, in mslength
- - the required length for the session idvoid get(String cookieValue, Handler<AsyncResult<Session>> resultHandler)
cookieValue
- the unique ID of the sessionresultHandler
- will be called with a result holding the session, or a failuredefault Future<Session> get(String cookieValue)
cookieValue
- the unique ID of the sessionget(String, Handler)
void delete(String id, Handler<AsyncResult<Void>> resultHandler)
id
- the session idresultHandler
- will be called with a success or a failuredefault Future<Void> delete(String cookieValue)
cookieValue
- the unique ID of the sessiondelete(String, Handler)
void put(Session session, Handler<AsyncResult<Void>> resultHandler)
session
- the sessionresultHandler
- will be called with a success or a failuredefault Future<Void> put(Session session)
session
- the sessionput(Session, Handler)
void clear(Handler<AsyncResult<Void>> resultHandler)
resultHandler
- will be called with a success or a failuredefault Future<Void> clear()
clear(Handler)
void size(Handler<AsyncResult<Integer>> resultHandler)
Beware of the result which is just an estimate, in particular with distributed session stores.
resultHandler
- will be called with the number, or a failuredefault Future<Integer> size()
size(Handler)
void close()
Copyright © 2021 Eclipse. All rights reserved.