Class List Method List File List

# Class: VertxWeb::ClusteredSessionStore

Inherits:
  SessionStore
  - Object
  - SessionStore
  - VertxWeb::ClusteredSessionStore
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb

## Overview

A session store which stores sessions in a distributed map so they are available across the cluster.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxWeb::ClusteredSessionStore) create(param_1 = nil, param_2 = nil, param_3 = nil)
  Create a session store.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) clear { ... }
  Remove all sessions from the store.
- - (void) close
  Close the store.
- - (::VertxWeb::Session) create_session(timeout = nil, length = 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.
- - (Fixnum) retry_timeout
  The retry timeout value in milli seconds used by the session handler when it retrieves a value from the store.
- - (void) size { ... }
  Get the number of sessions in the store.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    21
    22
    23
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 21

    def @@j_api_type.accept?(obj)
      obj.class == ClusteredSessionStore
    end

### + (`::VertxWeb::ClusteredSessionStore`) create(vertx) + (`::VertxWeb::ClusteredSessionStore`) create(vertx, sessionMapName) + (`::VertxWeb::ClusteredSessionStore`) create(vertx, retryTimeout) + (`::VertxWeb::ClusteredSessionStore`) create(vertx, sessionMapName, retryTimeout)

Create a session store.

The retry timeout value, configures how long the session handler will retry to get a session from the store when it is not found.

Overloads:

- + (`::VertxWeb::ClusteredSessionStore`) create(vertx)

  Parameters:

  - vertx (`::Vertx::Vertx`) —
    the Vert.x instance
- + (`::VertxWeb::ClusteredSessionStore`) create(vertx, sessionMapName)

  Parameters:

  - vertx (`::Vertx::Vertx`) —
    the Vert.x instance
  - sessionMapName (`String`) —
    the session map name
- + (`::VertxWeb::ClusteredSessionStore`) create(vertx, retryTimeout)

  Parameters:

  - vertx (`::Vertx::Vertx`) —
    the Vert.x instance
  - retryTimeout (`Fixnum`) —
    the store retry timeout, in ms
- + (`::VertxWeb::ClusteredSessionStore`) create(vertx, sessionMapName, retryTimeout)

  Parameters:

  - vertx (`::Vertx::Vertx`) —
    the Vert.x instance
  - sessionMapName (`String`) —
    the session map name
  - retryTimeout (`Fixnum`) —
    the store retry timeout, in ms

Returns:

- (`::VertxWeb::ClusteredSessionStore`) —
  the session store

Raises:

- (`ArgumentError`)

    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 131

    def self.create(param_1=nil,param_2=nil,param_3=nil)
      if param_1.class.method_defined?(:j_del) && !block_given? && param_2 == nil && param_3 == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebSstore::ClusteredSessionStore.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(param_1.j_del),::VertxWeb::ClusteredSessionStore)
      elsif param_1.class.method_defined?(:j_del) && param_2.class == String && !block_given? && param_3 == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebSstore::ClusteredSessionStore.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class]).call(param_1.j_del,param_2),::VertxWeb::ClusteredSessionStore)
      elsif param_1.class.method_defined?(:j_del) && param_2.class == Fixnum && !block_given? && param_3 == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebSstore::ClusteredSessionStore.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::long.java_class]).call(param_1.j_del,param_2),::VertxWeb::ClusteredSessionStore)
      elsif param_1.class.method_defined?(:j_del) && param_2.class == String && param_3.class == Fixnum && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebSstore::ClusteredSessionStore.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class,Java::long.java_class]).call(param_1.j_del,param_2,param_3),::VertxWeb::ClusteredSessionStore)
      end
      raise ArgumentError, "Invalid arguments when calling create(#{param_1},#{param_2},#{param_3})"
    end

### + (`Object`) j_api_type

    30
    31
    32
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 30

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    33
    34
    35
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 33

    def self.j_class
      Java::IoVertxExtWebSstore::ClusteredSessionStore.java_class
    end

### + (`Object`) unwrap(obj)

    27
    28
    29
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 27

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    24
    25
    26
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 24

    def @@j_api_type.wrap(obj)
      ClusteredSessionStore.new(obj)
    end

## 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`)

    91
    92
    93
    94
    95
    96
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 91

    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`)

    108
    109
    110
    111
    112
    113
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 108

    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, length = nil)

Create a new session

Parameters:

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

Returns:

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

Raises:

- (`ArgumentError`)

    50
    51
    52
    53
    54
    55
    56
    57
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 50

    def create_session(timeout=nil,length=nil)
      if timeout.class == Fixnum && !block_given? && length == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createSession, [Java::long.java_class]).call(timeout),::VertxWeb::Session)
      elsif timeout.class == Fixnum && length.class == Fixnum && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createSession, [Java::long.java_class,Java::int.java_class]).call(timeout,length),::VertxWeb::Session)
      end
      raise ArgumentError, "Invalid arguments when calling create_session(#{timeout},#{length})"
    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`)

    72
    73
    74
    75
    76
    77
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 72

    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`)

    62
    63
    64
    65
    66
    67
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 62

    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`)

    82
    83
    84
    85
    86
    87
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 82

    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

### - (`Fixnum`) retry_timeout

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:

- (`Fixnum`) —
  the timeout value, in ms

Raises:

- (`ArgumentError`)

    40
    41
    42
    43
    44
    45
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 40

    def retry_timeout
      if !block_given?
        return @j_del.java_method(:retryTimeout, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling retry_timeout()"
    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`)

    100
    101
    102
    103
    104
    105
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/clustered_session_store.rb', line 100

    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