lib/async/redis/client.rb in async-redis-0.3.3 vs lib/async/redis/client.rb in async-redis-0.3.4
- old
+ new
@@ -98,10 +98,22 @@
ensure
context.close
end
end
+ def nested(&block)
+ context = Context::Nested.new(@pool)
+
+ return context unless block_given?
+
+ begin
+ yield context
+ ensure
+ context.close
+ end
+ end
+
def call(*arguments)
@pool.acquire do |connection|
connection.write_request(arguments)
return connection.read_response
@@ -111,10 +123,10 @@
protected
def connect(connection_limit: nil)
Pool.new(connection_limit) do
peer = @endpoint.connect
-
+
peer.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
stream = IO::Stream.new(peer)
@protocol.client(stream)