Class List Method List File List

# Class: VertxWeb::SessionStore

Inherits:
  Object
  - Object
  - VertxWeb::SessionStore
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session_store.rb

## Overview

A session store is used to store sessions for an Vert.x-Web web app

## Direct Known Subclasses

ClusteredSessionStore, LocalSessionStore

## Instance Method Summary (collapse)

- - (void) clear { ... }
  Remove all sessions from the store.
- - (void) close
  Close the store.
- - (::VertxWeb::Session) create_session(timeout = nil)
  Create a new session.
- - (void) delete(id = nil) { ... }
  Delete the session with the specified ID.
- - (void) get(id = nil) { ... }
  Get the session with the specified ID.
- - (void) put(session = nil) { ... }
  Add a session with the specified ID.
- - (void) size { ... }
  Get the number of sessions in the store.

## Instance Method Details

### - (`void`) clear { ... }

This method returns an undefined value.

Remove all sessions from the store

Yields:

- will be called with a result true/false, or a failure

Raises:

- (`ArgumentError`)

    59
    60
    61
    62
    63
    64
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session_store.rb', line 59

    def clear
      if block_given?
        return @j_del.java_method(:clear, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling clear()"
    end

### - (`void`) close

This method returns an undefined value.

Close the store

Raises:

- (`ArgumentError`)

    76
    77
    78
    79
    80
    81
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session_store.rb', line 76

    def close
      if !block_given?
        return @j_del.java_method(:close, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling close()"
    end

### - (`::VertxWeb::Session`) create_session(timeout = nil)

Create a new session

Parameters:

- timeout (`Fixnum`) (defaults to: `nil`) —
  - the session timeout, in ms

Returns:

- (`::VertxWeb::Session`) —
  the session

Raises:

- (`ArgumentError`)

    20
    21
    22
    23
    24
    25
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session_store.rb', line 20

    def create_session(timeout=nil)
      if timeout.class == Fixnum && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createSession, [Java::long.java_class]).call(timeout),::VertxWeb::Session)
      end
      raise ArgumentError, "Invalid arguments when calling create_session(timeout)"
    end

### - (`void`) delete(id = nil) { ... }

This method returns an undefined value.

Delete the session with the specified ID

Parameters:

- id (`String`) (defaults to: `nil`) —
  the unique ID of the session

Yields:

- will be called with a result true/false, or a failure

Raises:

- (`ArgumentError`)

    40
    41
    42
    43
    44
    45
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session_store.rb', line 40

    def delete(id=nil)
      if id.class == String && block_given?
        return @j_del.java_method(:delete, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(id,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling delete(id)"
    end

### - (`void`) get(id = nil) { ... }

This method returns an undefined value.

Get the session with the specified ID

Parameters:

- id (`String`) (defaults to: `nil`) —
  the unique ID of the session

Yields:

- will be called with a result holding the session, or a failure

Raises:

- (`ArgumentError`)

    30
    31
    32
    33
    34
    35
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session_store.rb', line 30

    def get(id=nil)
      if id.class == String && block_given?
        return @j_del.java_method(:get, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(id,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxWeb::Session) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling get(id)"
    end

### - (`void`) put(session = nil) { ... }

This method returns an undefined value.

Add a session with the specified ID

Parameters:

- session (`::VertxWeb::Session`) (defaults to: `nil`) —
  the session

Yields:

- will be called with a result true/false, or a failure

Raises:

- (`ArgumentError`)

    50
    51
    52
    53
    54
    55
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session_store.rb', line 50

    def put(session=nil)
      if session.class.method_defined?(:j_del) && block_given?
        return @j_del.java_method(:put, [Java::IoVertxExtWeb::Session.java_class,Java::IoVertxCore::Handler.java_class]).call(session.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling put(session)"
    end

### - (`void`) size { ... }

This method returns an undefined value.

Get the number of sessions in the store

Yields:

- will be called with the number, or a failure

Raises:

- (`ArgumentError`)

    68
    69
    70
    71
    72
    73
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session_store.rb', line 68

    def size
      if block_given?
        return @j_del.java_method(:size, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling size()"
    end