io.vertx.ext.web.sstore

## Interface SessionStore

- All Known Subinterfaces:
    ClusteredSessionStore, CookieSessionStore, InfinispanSessionStore, LocalSessionStore, RedisSessionStore

      public interface SessionStore

  A session store is used to store sessions for an Vert.x-Web web app
  Author:
    Tim Fox, Paulo Lopes

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_SESSIONID_LENGTH` Default length for a session id.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `Future<Void>` | `clear()`
    `default SessionStore` | `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.
    `Future<Void>` | `delete(String cookieValue)`
    `default SessionStore` | `delete(String id, Handler<AsyncResult<Void>> resultHandler)` Delete the session with the specified ID.
    `Future<Session>` | `get(String cookieValue)`
    `default SessionStore` | `get(String cookieValue, Handler<AsyncResult<Session>> resultHandler)` Get the session with the specified ID.
    `SessionStore` | `init(Vertx vertx, JsonObject options)` Initialize this store.
    `Future<Void>` | `put(Session session)`
    `default SessionStore` | `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.
    `Future<Integer>` | `size()`
    `default SessionStore` | `size(Handler<AsyncResult<Integer>> resultHandler)` Get the number of sessions in the store.

- - ### Field Detail

    - #### DEFAULT_SESSIONID_LENGTH

          static final int DEFAULT_SESSIONID_LENGTH

      Default length for a session id. More info: https://www.owasp.org/index.php/Session_Management_Cheat_Sheet
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### create

          static SessionStore create(Vertx vertx)

      Create a Session store given a backend and configuration JSON.
      Parameters:
        `vertx` - vertx instance
      Returns:
        the store or runtime exception

    - #### create

          static SessionStore create(Vertx vertx,
                                     JsonObject options)

      Create a Session store given a backend and configuration JSON.
      Parameters:
        `vertx` - vertx instance
        `options` - extra options for initialization
      Returns:
        the store or runtime exception

    - #### init

          SessionStore init(Vertx vertx,
                            JsonObject options)

      Initialize this store.
      Parameters:
        `vertx` - the vertx instance
        `options` - optional Json with extra configuration options
      Returns:
        self

    - #### retryTimeout

          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.
      Returns:
        the timeout value, in ms

    - #### createSession

          Session createSession(long timeout)

      Create a new session using the default min length.
      Parameters:
        `timeout` - - the session timeout, in ms
      Returns:
        the session

    - #### createSession

          Session createSession(long timeout,
                                int length)

      Create a new session.
      Parameters:
        `timeout` - - the session timeout, in ms
        `length` - - the required length for the session id
      Returns:
        the session

    - #### get

          default SessionStore get(String cookieValue,
                                   Handler<AsyncResult<Session>> resultHandler)

      Get the session with the specified ID.
      Parameters:
        `cookieValue` - the unique ID of the session
        `resultHandler` - will be called with a result holding the session, or a failure

    - #### get

          Future<Session> get(String cookieValue)

      Parameters:
        `cookieValue` - the unique ID of the session
      Returns:
        future that will be called with a result holding the session, or a failure
      See Also:
        `get(String, Handler)`

    - #### delete

          default SessionStore delete(String id,
                                      Handler<AsyncResult<Void>> resultHandler)

      Delete the session with the specified ID.
      Parameters:
        `id` - the session id
        `resultHandler` - will be called with a success or a failure

    - #### delete

          Future<Void> delete(String cookieValue)

      Parameters:
        `cookieValue` - the unique ID of the session
      Returns:
        future that will be called with a result, or a failure
      See Also:
        `delete(String, Handler)`

    - #### put

          default SessionStore put(Session session,
                                   Handler<AsyncResult<Void>> resultHandler)

      Add a session with the specified ID.
      Parameters:
        `session` - the session
        `resultHandler` - will be called with a success or a failure

    - #### put

          Future<Void> put(Session session)

      Parameters:
        `session` - the session
      Returns:
        future that will be called with a result, or a failure
      See Also:
        `put(Session, Handler)`

    - #### clear

          default SessionStore clear(Handler<AsyncResult<Void>> resultHandler)

      Remove all sessions from the store.
      Parameters:
        `resultHandler` - will be called with a success or a failure

    - #### clear

          Future<Void> clear()

      Returns:
        future that will be called with a result, or a failure
      See Also:
        `clear(Handler)`

    - #### size

          default SessionStore size(Handler<AsyncResult<Integer>> resultHandler)

      Get the number of sessions in the store.

      Beware of the result which is just an estimate, in particular with distributed session stores.

      Parameters:
        `resultHandler` - will be called with the number, or a failure

    - #### size

          Future<Integer> size()

      Returns:
        future that will be called with a result, or a failure
      See Also:
        `size(Handler)`

    - #### close

          void close()

      Close the store

Copyright © 2022 Eclipse. All rights reserved.