Class: VertxRedis::RedisConnection

Inherits:
Object
  • Object
show all
Includes:
Vertx::ReadStream
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb

Overview

A simple Redis client.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


25
26
27
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 25

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

+ (Object) j_api_type



34
35
36
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 34

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



37
38
39
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 37

def self.j_class
  Java::IoVertxRedisClient::RedisConnection.java_class
end

+ (Object) unwrap(obj)



31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 31

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

+ (Object) wrap(obj)



28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 28

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

Instance Method Details

- (self) batch(commands, onSend) { ... }

Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.

Parameters:

Yields:

  • the asynchronous result handler.

Returns:

  • (self)


147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 147

def batch(*args)
  if args[0].class == Array && true
    if (block_given?)
      @j_del.java_method(:batch, [Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].map { |element| element.j_del },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxRedis::Response) } : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:batch, [Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].map { |element| element.j_del },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxRedis::Response) } : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling batch(#{args[0]})"
  end
end

- (void) close

This method returns an undefined value.

Closes the connection or returns to the pool.


182
183
184
185
186
187
188
189
190
191
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 182

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

- (self) endHandler(endHandler) { ... }

Yields:

Returns:

  • (self)


115
116
117
118
119
120
121
122
123
124
125
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 115

def end_handler
  if true
    @j_del.java_method(:endHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(nil) unless !block_given? }))
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling end_handler()"
  end
end

- (self) exceptionHandler(handler) { ... }

Yields:

Returns:

  • (self)


218
219
220
221
222
223
224
225
226
227
228
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 218

def exception_handler
  if true
    @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) unless !block_given? }))
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling exception_handler()"
  end
end

- (self) fetch(amount)

Parameters:

  • amount (Fixnum)

Returns:

  • (self)


130
131
132
133
134
135
136
137
138
139
140
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 130

def fetch(*args)
  if args[0].class == Fixnum && !block_given?
    @j_del.java_method(:fetch, [Java::long.java_class]).call(args[0])
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling fetch(#{args[0]})"
  end
end

- (self) handler(handler) { ... }

Yields:

Returns:

  • (self)


74
75
76
77
78
79
80
81
82
83
84
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 74

def handler
  if true
    @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxRedis::Response)) unless !block_given? }))
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling handler()"
  end
end

- (self) pause

Returns:

  • (self)


232
233
234
235
236
237
238
239
240
241
242
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 232

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

- (true, false) pendingQueueFull

Flag to notify if the pending message queue (commands in transit) is full. When the pending message queue is full and a new send command is issued it will result in a exception to be thrown. Checking this flag before sending can allow the application to wait before sending the next message.

Returns:

  • (true, false)
    true is queue is full.


46
47
48
49
50
51
52
53
54
55
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 46

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

- (::Vertx::Pipe) pipe

Pause this stream and return a to transfer the elements of this stream to a destination .

The stream will be resumed when the pipe will be wired to a WriteStream.

Returns:



169
170
171
172
173
174
175
176
177
178
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 169

def pipe
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:pipe, []).call(),::Vertx::Pipe,::VertxRedis::Response.j_api_type)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling pipe()"
  end
end

- (void) pipeTo(dst, handler) { ... }

This method returns an undefined value.

Pipe this ReadStream to the WriteStream.

Elements emitted by this stream will be written to the write stream until this stream ends or fails.

Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

Parameters:

Yields:



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 95

def pipe_to(*args)
  if args[0].class.method_defined?(:j_del) && true
    if (block_given?)
      return @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling pipe_to(#{args[0]})"
  end
end

- (self) resume

Returns:

  • (self)


59
60
61
62
63
64
65
66
67
68
69
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 59

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

- (self) send(command, onSend) { ... }

Send the given command to the redis server or cluster.

Parameters:

Yields:

  • the asynchronous result handler.

Returns:

  • (self)


197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_connection.rb', line 197

def send(*args)
  if args[0].class.method_defined?(:j_del) && true
    if (block_given?)
      @j_del.java_method(:send, [Java::IoVertxRedisClient::Request.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxRedis::Response) : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:send, [Java::IoVertxRedisClient::Request.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxRedis::Response) : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxRedis::Response.j_api_type)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling send(#{args[0]})"
  end
end